git - how to get default branch?

前端 未结 9 2226
轻奢々
轻奢々 2020-12-04 17:44

My team alternates between usage of dev and master as default branch for several repos and I would like to write a script that checks for the default branch when entering a

9条回答
  •  臣服心动
    2020-12-04 18:22

    There is a --short option to git symbolic-ref. So my preferred command:

    $ git symbolic-ref --short HEAD
    master
    

提交回复
热议问题