We are trying to follow the branching strategy from the TFS Branching Guide and have reached the point where we have made a branch representing a release, which should now be made read-only.
In the Properties|Security tab for the branch, it presents six user groups each with 10 permissions other than Read. Do I have to go through and click Deny on 60 check boxes, or is there a better way to make this branch read-only?
Lock a branch using the Branches view You can search for your branch using the Search all branches box in the upper right. Lock the branch by selecting the ... icon next to the branch name and then selecting Lock from the menu. A lock icon will appear next to the branch name.
To unlock a branch from Source Control Explorer, just right click--Advanced--unlock. In addition, you can unlock an item explicitly by using the unlock command or implicitly when you check in. When you check in pending changes to a locked item, Team Foundation removes any locks.
locking a branch prevents other users from changing the existing commit history. Locking also blocks any new commits from being added to the branch by others.
With TFS, there are several ways that you can handle releases. You can tag/label each release branch or bug fix. But the relationship between release branches and the release is not always clear. Teams need to create a naming scheme and define a TFS branching strategy to help document the flow of change.
Right-click the branch in the Source Control Explorer, and select the Lock... option
EDIT: This seems to get missed a lot when people are finding this so I'll make it more obvious.
Locks appear as a "pending change" for the person who locked the item. As long as the lock is in effect, it will appear as a pending change. When a commit is made of that pending change, the lock is released. While the lock is in effect, the locked branch is effectively read-only, since (to simplify) the locker is the only user who can make commits. The act of committing is what releases any locks on the branch.
h/t @AakashM for pointing that out in the comments
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With