Freezing a Git branch Freezing a Git branch git git

Freezing a Git branch


Christopher is right, tagging will help you do this. I recommend deleting the branch name too to make it a little harder for someone to checkout the branch and make edits.

First, merge the branch into develop

git checkout developgit merge --no-ff feature_1 

Then checkout the branch

git checkout feature_1

Then create a tag, with a comment.

git tag -a -m "Freezing a feature branch that fixes.." feature_1_frozen

Then delete the branch

git checkout developgit branch -d feature_1

After doing this, you won't be able to checkout the branch by name. Instead you'll be able to checkout the tag by name, this will put you into a detached head state which will deter changes to the code.

Now to wrap things up and sync with origin...

Push the update and new tag

git push --tags origin develop

Delete the remote feature branch

git push origin :feature_1


Just tag it.

git tag -a frozen -m "Feature branch frozen here."git push <remote> frozen

Sure, someone could come along later and push to the branch, but the tag shouldn't change unless it's forcibly overrode. You could configure your remote to reject force pushes if you're concerned about it, or even sign the tags with a GPG key to ensure authenticity.

Getting the state of the feature branch when it was frozen is as simple as git checkout frozen. Developers can branch from this point at will using one command: git checkout -B <new_branch> frozen.


You could use something like gitolite or gerrit for access controls and permission along branches, tags and repos.

Have a look here: