Set the default branch in a Git repository
If you're not using master as your main branch, it's useful to create an affordance for your repository users by setting the default branch to your main branch.
You do this by creating a symbolic reference to the branch head in .git/HEAD. Running git symbolic-ref HEAD refs/heads/main_branch
will do the trick.
$ cat .git/HEAD
ref: refs/heads/main_branch
Written by Damon Davison
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
khasinski
591.1K
dmichaelavila
500.4K
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#