Make an alias for existing branch

Michael Nikitochkin - Apr 10 - - Dev Community

Photo by Mohammad Rahmani on Unsplash

If you happened to miss the master branch and your organization uses the more populistic main naming convention as the default branch, don't worry!
You can easily switch back to the previous environment without causing any issues using a simple Git alias command.:

$ git symbolic-ref refs/heads/master refs/heads/main
Enter fullscreen mode Exit fullscreen mode

This tool won't replace everything, but it can help you use old commands like:

$ git checkout master

$ git rebase -i master

$ git diff master
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . .