Skip to content

Instantly share code, notes, and snippets.

@reconbot
Created November 4, 2021 04:06
Show Gist options
  • Save reconbot/01ee5aa03b9e4f72887d114addb1181e to your computer and use it in GitHub Desktop.
Save reconbot/01ee5aa03b9e4f72887d114addb1181e to your computer and use it in GitHub Desktop.
My git shortcuts
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