Aliasing your existing git branch

Hey, Thanks for taking the time to read this.
I'm a software enthusiast with over 10 years of experience in crafting software and organization. I thrive on taking on new challenges and exploring innovative ideas. When I'm not busy coding, I love to travel the world and have already visited 10 countries with 4 more on my upcoming list. I'm also passionate about discussing music, life, and new ideas. If you need someone to listen to your innovative idea, don't hesitate to buzz me. I'm always open to collaborating and lending an ear. With my passion for creativity and my drive to excel, I'm confident that I can help you take your project to the next level. Let's work together to turn your vision into a reality!
If you happened to miss the master branch and your organization has adopted the more popular main naming convention as the default branch, don’t worry! You can easily switch back to the previous environment without causing any issues. This can be done using a simple Git alias command, which allows you to create shortcuts for longer Git commands. By setting up an alias, you can quickly and efficiently switch between branches without having to remember the full command each time. This not only saves time but also reduces the chance of making errors when typing out commands. Here’s how you can set up a Git alias to switch back to the master branch:
git config --global alias.switch-master 'checkout master'
With this alias in place, you can simply type git switch-master to switch to the master branch.
Also you can create symlink for these git commands, for an example -
git symbolic-ref refs/heads/master refs/heads/main
This method ensures that you can seamlessly navigate between the main and master branches, maintaining your workflow without any disruptions.
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
Thank you for reading this article! If you're interested in DevOps, Security, or Leadership for your startup, feel free to reach out at hi@iamkaustav.com or book a slot in my calendar. Don't forget to subscribe to my newsletter for more insights on my security and product development journey. Stay tuned for more posts!





