Erwin Müller

Git Alias­es and Shortcuts

This is a list of com­mon git alias­es and short­cuts. In my opin­ion, cryp­tic alias­es like “gp” for git-push or “gc” for git-check­out are very hard to re­mem­ber. There­fore, I will write longer alias­es that are more eas­i­ly to re­mem­ber. Since bash or zsh have au­to-com­ple­tion, you can just write “git­co” and then press and let the bash au­to-com­plete it to “git­com­mit”. The most time con­sum­ing is the white­space be­tween the com­mands, since au­to-com­ple­tion can not guess what com­mand I need. I think that is a good com­pro­mise be­tween sav­ing time typ­ing and how easy it is to re­mem­ber all of the alias­es and short­cuts. I will add ad­di­tion­al alias­es and short­cuts as I need them.

Up­dat­ed on 2018 / 09 / 21

[shell title=”.user_rc”]
if git –version>/dev/null; then
alias gitcheck=“git checkout”
alias gitb=“git branch”
alias gitm=“git merge”
alias gitt=“git tag”
alias gitpush=“git push”
alias gitpull=“git pull”
alias gitpusho=“git push origin”
alias gitpullo=“git pull origin”
alias gitcommit=“git commit”
alias gitcommita=“git com­mit ‑a”
alias gitstash=“git stash”
alias gitstashp=“git stash pop”

alias gitstartrelease=“git flow re­lease start”
alias gitfinishrelease=“git flow re­lease finish”

#
# robobeerun projects
#

ROBOBEE_ID_RSA=”${HOME}/Projects/robobeerun.com/robobee-key/robobee_id_rsa”

#
# Usage:
#
# gitrobobee­git­hub­clone URL …
#
func­tion gitrobobeegithubclone() {
ssh-agent bash ‑c “ssh-add $ROBOBEE_ID_RSA; git clone ‑o github $@”
}

#
# Usage:
#
# gitrobobeegithubpull …
#
func­tion gitrobobeegithubpull() {
ssh-agent bash ‑c “ssh-add ${ROBOBEE_ID_RSA}; git pull github $@”
}

#
# Usage:
#
# gitrobobeegithubpush …
#
func­tion gitrobobeegithubpush() {
ssh-agent bash ‑c “ssh-add ${ROBOBEE_ID_RSA}; git push github $@”
}
fi
[/shell]

Leave a Reply

Your email address will not be published.