I found a way to detect the default-branch if it is not master.
git remote show [your_remote] | sed -n '/HEAD branch/s/.*: //p'
I tested it with multiple repo from gitlab, and it worked fine.
(for the most situations [your_remote]
will be origin
, run git remote
to check the name of your remote)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…