Last active
April 4, 2025 18:36
-
-
Save BrianValente/2ced29c93f2fbd53148bfd9e880535ff to your computer and use it in GitHub Desktop.
Git aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git: Force push current branch | |
alias gpf="git push --no-verify --force-with-lease --force-if-includes" | |
# Git: Get the commit hash from which the current branch was forked | |
alias gfch="diff -u <(git rev-list --first-parent \$(git rev-parse --abbrev-ref HEAD)) <(git rev-list --first-parent origin main) | sed -ne 's/^ //p' | head -1" | |
# Git: Rebase interactive commits compared to the branch from which the current branch was forked | |
alias gri="git rebase -i \$(gfch)" | |
# Git: Rebase interactive commits compared to the branch from which the current branch was forked with autostash | |
alias gria="gri --autostash" | |
# Git: Pull origin main with rebase and autostash | |
alias gprom="git pull --rebase origin main --autostash" | |
# Git: Amend last commit without editing the commit message | |
alias gcan="git commit --verbose --all --no-edit --amend" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment