7

More projects are changing their default branch from master to something else like main. Is there a way to checkout the default branch without having to look up if it's called master or main or something completely different?

Thomaschaaf
  • 17,847
  • 32
  • 94
  • 128
  • 2
    You may create your own alias for this, using other aliases like those provided by the following answer : https://stackoverflow.com/a/61357104/1887976 – Antwane Apr 29 '21 at 07:54
  • Does this answer your question? [git - how to get default branch?](https://stackoverflow.com/questions/28666357/git-how-to-get-default-branch) – kapsiR Apr 29 '21 at 08:08
  • https://stackoverflow.com/questions/28666357/git-how-to-get-default-branch/61357104#comment118981819_61357104 – kapsiR Apr 29 '21 at 09:03
  • [mjd2021usa](https://stackoverflow.com/users/16619948) posted an [Answer](https://stackoverflow.com/a/68704176) saying "While it's not exactly what you asked for, it achieves the same goal. Checkout: [https://joshtronic.com/2020/08/09/how-to-get-the-default-git-branch/](https://joshtronic.com/2020/08/09/how-to-get-the-default-git-branch/)" – Scratte Aug 17 '21 at 21:56

0 Answers0