My git shortcuts
This file contains 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
alias gb='gh pr view -w' | |
alias gp='git push origin HEAD' | |
alias gpf='git push --force-with-lease origin HEAD' | |
alias gpfo='git push --force-with-lease origin HEAD && gb' | |
alias gpo='git push origin HEAD && gb' | |
alias gcm='git checkout $(git_detect_main_branch)' | |
alias gcmp='git checkout $(git_detect_main_branch) && git pull origin $(git_detect_main_branch) --ff-only' | |
alias grom='git fetch && git rebase --autostash origin/$(git_detect_main_branch)' | |
function git_detect_main_branch() { | |
git branch -l --format '%(refname:short)' main master | head -n 1 | |
} | |
function gcb() { | |
git checkout -b reconbot/$1 | |
} | |
function gcmb() { | |
gcmp && git checkout -b reconbot/$1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment