# Locking When `plan` is run, the directory and Terraform workspace are **Locked** until the pull request is merged or closed, or the plan is manually deleted. If another user attempts to `plan` for the same directory and workspace in a different pull request they'll see this error:  Which links them to the pull request that holds the lock. ::: warning NOTE Only the directory in the repo and Terraform workspace are locked, not the whole repo. ::: ## Why 1. Because `atlantis apply` is being done before the pull request is merged, after an apply your `main` branch does not represent the most up to date version of your infrastructure anymore. With locking, you can ensure that no other changes will be made until the pull request is merged. ::: tip Why not apply on merge? Sometimes `terraform apply` fails. If the apply were to fail after the pull request was merged, you would need to create a new pull request to fix it. With locking + applying on the branch, you effectively mimic merging to main but with the added ability to re-plan/apply multiple times if things don't work. ::: 2. If there is already a `plan` in progress, other users won't see a plan that will be made invalid after the in-progress plan is applied. ## Viewing Locks To view locks, go to the URL that Atlantis is hosted at:  You can click on a lock to view its details: