Skip to content

Instantly share code, notes, and snippets.

@jlyon
Last active November 10, 2021 04:50
Show Gist options
  • Save jlyon/e461fca78038e2390e845fb18dfd111a to your computer and use it in GitHub Desktop.
Save jlyon/e461fca78038e2390e845fb18dfd111a to your computer and use it in GitHub Desktop.
git .bash_profile commands
# Git custom stuff https://gist.github.com/jlyon/e461fca78038e2390e845fb18dfd111a
gitListCommands()
{
echo ''
echo 'Git commands:'
echo ''
echo 'alias gb="git branch --sort=-committerdate"'
echo 'alias gbc="git branch {current}"'
echo 'alias gs="git status"'
echo 'alias gd="git diff"'
echo 'alias ga="git add"'
echo 'alias gf="git fetch"'
echo 'alias gco="git checkout"'
echo 'alias gr="git rebase"'
echo 'alias grc="git rebase --continue"'
echo 'alias gc="git commit"'
echo 'alias gcm="git commit -m"'
echo 'alias gm="git merge"'
echo 'alias gms="git merge --squash"'
echo 'alias gf="git fetch"'
echo 'alias gpl="git pull origin"'
echo 'alias gplc="git pull origin {current}'
echo 'alias gp="git push origin"'
echo 'alias gpc="git push origin {current}'
echo 'alias gpr="gpc && gh pr create -w'
echo ''
}
alias g=gitListCommands
alias gb="git branch --sort=-committerdate | head -n20"
alias gbc="git rev-parse --abbrev-ref HEAD"
alias gs="git status"
alias gd="git diff"
alias ga="git add"
alias gf="git fetch"
alias gco="git checkout"
alias gr="git rebase"
alias grc="git rebase --continue"
alias gc="git commit"
alias gcm="git commit -m"
alias gm="git merge"
alias gms="git merge --squash"
alias gf="git fetch"
alias gpl="git pull origin"
alias gplc='echo "git pull origin $(gbc)" && git pull origin $(gbc)'
alias gp="git push origin"
alias gpc='echo "git push origin $(gbc)" && git push origin $(gbc)'
alias gpr='gpc && gh pr create -w'
gbs() {
git branch --sort=-committerdate | grep "$1" | head -n30
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment