4

Is there a way so set a branch as inactive or frozen ? Indeed, I don't want to delete my branch as I'm likely to work on it in the future but the branch is currently frozen.

I know i can change the name of the branch to a pattern like frozen/my-branch but I'd like to know whether a native way to achieve this already exists in git.

Thanks!

Simon
  • 1,679
  • 4
  • 21
  • 37
  • possible duplicate of [Freezing a Git branch](http://stackoverflow.com/questions/10996248/freezing-a-git-branch) – brandizzi Jan 03 '14 at 12:54

1 Answers1

4

No, there is no way AFAIK. A solution I like most is to make a tag to the head of the branch. If I have a branch foo which will not work for some time, I usually do:

git tag TAG-foo foo
git branch -D foo

Now it does not clutter the git branch output anymore and I can get it back whenever I want.

EDIT: I answered from memory but got curious about it and searched on Google. I found this interesting extension but I have never used int so I can't endorse it.

brandizzi
  • 26,083
  • 8
  • 103
  • 158
  • 2
    +1 for the 'interesting extension' https://github.com/smoynes/git-freeze/blob/master/bin/git-freeze I had been looking at trying to create a special (empty) 'dead-branch' into which they were merged, but this looks more interesting / useful / off-the-shelf. (The problem was to get the tree sha1 on of the last commit to as to avoid a checkout-merge and directly construct the dead-branch commit) – Philip Oakley Jan 03 '14 at 17:01
  • It's been a million years since you posted this solution; is it still what you use or have you found something better? I'm a heavy user of feature-branches as a developer, but my boss is slow to check and merge my work. I have a workaround, but want a way to "deprecate" or "inactivate" the old branches (in particular, on the remote side). – Jess Dec 17 '21 at 15:23
  • Hey! I still use branch-to-tag approach. There may be other solutions these days, but I'll be honest, I didn't discover any so far. – brandizzi Dec 18 '21 at 19:38