1
0
mirror of https://github.com/frebib/dotfiles.git synced 2024-06-14 12:57:23 +00:00

git: Dynamically identify the "default" branch

This broadly assumes that the "default" remote is called "origin", but
that's better than assuming that plus the default branch name.

Thanks to https://joshtronic.com/2020/08/09/how-to-get-the-default-git-branch/

Suggested-by: Chris Lane <chris@chrislane.com>
Signed-off-by: Joe Groocock <me@frebib.net>
This commit is contained in:
2022-05-18 10:46:05 +00:00
parent dcfd191613
commit ba6173e0ee
2 changed files with 4 additions and 3 deletions

View File

@ -37,6 +37,7 @@
count = !echo $(pwd) && git rev-list HEAD --count
unpushed = !git log --oneline @{u}..HEAD
leaders = !git shortlog -s -n --all --no-merges
defbranch = !git symbolic-ref refs/remotes/origin/HEAD | sed \"s@^refs/remotes/origin/@@\"
[advice]
statusHints = false
pushUpdateRejected = false