Skip to content

Commit a80d898

Browse files
authored
Merge pull request #2176 from royatt/improve-git-aliases
2 parents 0375b77 + d9c339c commit a80d898

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

aliases/available/git.aliases.bash

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ alias gpatch='git format-patch -1'
110110
# push
111111
alias gp='git push'
112112
alias gpd='git push --delete'
113-
alias gpf='git push --force'
113+
alias gpf='git push --force-with-lease'
114+
alias gpff='git push --force'
114115
alias gpo='git push origin HEAD'
115116
alias gpom='git push origin $(get_default_branch)'
116117
alias gpu='git push --set-upstream'
@@ -211,9 +212,6 @@ function gdv() {
211212
}
212213

213214
function get_default_branch() {
214-
if git branch | grep -q '^. main\s*$'; then
215-
echo main
216-
else
217-
echo master
218-
fi
215+
branch=$(git symbolic-ref refs/remotes/origin/HEAD)
216+
${branch#refs/remotes/origin/}
219217
}

0 commit comments

Comments
 (0)