Using /x1/gitbox/bin/change-default-branch.py on gitbox (as root or www-data), you can batch change multiple repos default branch.

Repo names can include .git or not, it doesn't matter.


Usage examples:


  • Changing all repos from master to main:

    $ /x1/gitbox/bin/change-default-branch.py main
    foo.git
    bar.git
    baz.git
    (Ctrl+D)
  • Changing repos to various branches, but default to main if not specified

    $ /x1/gitbox/bin/change-default-branch.py main
    foo.git
    bar.git blurbbranch
    baz.git anotherbranch
    (Ctrl+D)
  • Alternately, changing all repos to main by reading from a text list:

    $ /x1/gitbox/bin/change-default-branch.py main < list-of-repos.txt