Remove/hide git branches without deleting commit histories

后端 未结 1 1932
有刺的猬
有刺的猬 2020-12-13 12:59

Situation:

I have a main repo with a main dev branch and lots of \"experiment\" branches sprouting off from it (e.g., exp1 and ex

相关标签:
1条回答
  • 2020-12-13 13:41

    Here's one alternative: use non-branch references to save the branch-tips before deleting the branch names.

    Since these are non-branch references, they won't show up in git branch output, nor in stuff shown by git log --branches and gitk --branches, for instance. However, they will show up in --all listings, and will retain repository objects.

    To create or update a non-branch reference, use git update-ref. Choose a name-space within refs/ that you think will not collide with some future use (current uses are refs/heads/ for branches, refs/tags/ for tags, refs/remotes/ for remote branches, refs/notes/ for notes, and refs/stash for the stash).

    0 讨论(0)
提交回复
热议问题