Tomas Romero
Tomas Romero

Reputation: 8708

Leave branch as a mere etiquette but with out being able to access it in GIT

I want to be able to virtually delete a branch, so no one can checkout it and make changes from that point, but leaving the name of the branch as an indicator or etiquette in the history.

In other words I want gitk to keep showing me the names of my past branches, whether or not I had deleted them.

Is this possible?

Upvotes: 1

Views: 80

Answers (1)

bcmcfc
bcmcfc

Reputation: 26805

Sounds like you want tagging.

Example usage:

git tag archive/branch_name

git push origin archive/branch_name

You could then delete the branch referenced by the tag.

Personally, I use the below alias to tag a branch, push it and delete both the remote branch and the local one:

tagarchive = !f() { git tag archive/$1 origin/$1 && git push origin :$1 && git push origin archive/$1 && git branch -d $1; }; f

Usage: git tagarchive branch_name

Upvotes: 3

Related Questions