Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a TFS Branch Read-Only

Tags:

branch

tfs

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?

like image 875
Mark Heath Avatar asked Jun 24 '09 14:06

Mark Heath


People also ask

How do you lock a branch in TFS?

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.

How do I unlock a branch in TFS?

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.

What does locking a branch do?

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.

How do you handle branches in TFS?

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.


1 Answers

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

like image 108
Josh E Avatar answered Nov 07 '22 23:11

Josh E