Select Page

There are aliases for some common git commands at the bottom.  Just copy and paste them into your .bashrc or .bash_profile file in your User’s folder.  You will need to open a new Terminal or Git Bash window for them to take effect.

git pull [options] <repository> <branch>
git pull -f <repository> <branch>

git fetch [options] <repository> <branch>
git fetch –all
git reset –hard <repository>/<branch>

git push [options] <repository> <branch>

git status (gs)
git add [options] <pathspec> (ga)
git add . (ga.)
git rm [options] <pathspec>
git rm $(git ls-files –deleted) (grma)

git commit [options] (gc)
git commit -m <message>
git add -a -m <message>

git branch [options] <branch> (gb)
git branch -d
git branch -D
git push –delete

git checkout <branch> || <commit> || <pathspec>(go)
git checkout -b <branch>

git branch –set-upstream-to=<repository>/<repository-branch> <local-branch>

git merge <branch>

git log [options] (gl)
git log –
git log –since=”” ex. git log –since=”2015-04-27″
git log –grep

git diff [options] <commit> || <commit> <commit> || <pathspec> || <pathspec> <pathspec> (gd)
gitk [options] <pathspec> (gitk)

git config -global user.name “<username>”
git config -global user.email <email_address>
git config –list
git help

.bashrc
Copy commands below into a .bashrc or .bash_profile file and put into your User’s folder and open a new Terminal or Git Bash window.

alias gs=’git status ‘
alias ga=’git add ‘
alias ga.=’git add .’
alias gb=’git branch ‘
alias gc=’git commit ‘
alias gd=’git diff’
alias go=’git checkout ‘
alias gk=’gitk –all&’
alias gx=’gitx –all’
alias gl=”git log –color –graph –pretty=format:’%Cred%h%Creset %s %Cgreen(%cr) -%C(yellow)%d%Creset %C(bold blue)<%an>%Creset’ –abbrev-commit”
alias grma=’git rm $(git ls-files –deleted)’

alias got=’git ‘
alias get=’git ‘