Skip to content

Instantly share code, notes, and snippets.

@reconbot
Created November 4, 2021 04:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
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