Skip to content

Renaming branches #301

Answered by newren
eliottwiener asked this question in Q&A
Nov 17, 2021 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

If you want to rename a branch, just use git branch -m <oldbranch> <newbranch>; no need to use a history filtering tool to achieve that. You'll note that git tag does not have a rename operation similar to git branch -m .... The reason is that there are special tag objects (but not any special branch objects), and those tag objects not only store a message but also (semi-redundantly) record the name of the tag. For the non-lightweight tags to really be renamed, those tag objects also have to be rewritten to record the new name, which is what makes it a history modifying operation.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@eliottwiener
Comment options

@gasbi
Comment options

Answer selected by eliottwiener
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants