Renaming branches #301
-
In the README there is an example given that uses git filter-repo --path src/ --to-subdirectory-filter my-module --tag-rename '':'my-module-' Is there a flag for renaming branches as well, similar to I would like to be able to rename all branches to add a prefix. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
If you want to rename a branch, just use |
Beta Was this translation helpful? Give feedback.
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 thatgit tag
does not have a rename operation similar togit 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.