gitbare

Rename branches in git bare repository


Is it ok to rename branches in bare repository at packed-refs file?

I want to rename it from:

# pack-refs with: peeled fully-peeled 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa refs/heads/master
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb refs/heads/new

to:

# pack-refs with: peeled fully-peeled 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa refs/heads/old
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb refs/heads/master

Solution

  • As torek stated:

    You can rename branches by issuing the command

    Usage:

    git branch -m <oldbranch> <newbranch>
    

    Source: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging