diff --git a/aliases/available/git.aliases.bash b/aliases/available/git.aliases.bash index 535665b14d..11ea2518d1 100644 --- a/aliases/available/git.aliases.bash +++ b/aliases/available/git.aliases.bash @@ -103,7 +103,8 @@ alias gpatch='git format-patch -1' # push alias gp='git push' alias gpd='git push --delete' -alias gpf='git push --force' +alias gpf='git push --force-with-lease' +alias gpff='git push --force' alias gpo='git push origin HEAD' alias gpom='git push origin $(get_default_branch)' alias gpu='git push --set-upstream' @@ -200,9 +201,6 @@ function gdv() { } function get_default_branch() { - if git branch | grep -q '^. main\s*$'; then - echo main - else - echo master - fi + branch=$(git symbolic-ref refs/remotes/origin/HEAD) + ${branch#refs/remotes/origin/} }