#Table Of Contents



From my .gitconfig

  • Includes typos.
  diff = auto
  status = auto
  branch = auto
  ui = true
  ci = commit
  cloen = clone
  co = checkout
  chekcout = checkout
  dif = diff
  l = log
  l1 = log -n1 -p
  ll = log -p
  stauts = status


git config "Aizat Faiz"
git config


Include branch in shell.


  • You always know which branch is being worked on.


From my .bash_profile

alias ga='git add'
alias gb='git branch'
alias gba='git branch -a'
alias gau='git add -u'
alias gca='git commit --amend --no-edit'
alias gci='git commit'
alias gcm='git commit -m'
alias gco='git checkout'
alias gdc='git diff --cached'
alias gd='git diff'
alias gdd='git diff --name-only HEAD^ | cat'
alias gf='git fetch'
alias gfgsr='git fetch && git svn rebase'
alias gl='git log'
alias gl1='git log -n1'
alias gl1p='git log -n1 -p'
alias gll='git log -p'
alias gp='git pull'
alias gpr='git pull --rebase'
alias grc='git rebase --continue'
alias gs='git status'
alias gsi='git submodule init'
alias gsu='git submodule update'
alias gsr='git svn rebase'
alias gsrgf='git svn rebase && git fetch && git svn rebase'
alias gf='git diff-tree --no-commit-id --name-only -r HEAD'


git diff --name-only
git log --graph

Compare diff with another branch, good for flattening:

git diff master..branchname
git diff branchname..master
git diff master..HEAD

Display file changes between revisions:

git diff --name-only HEAD^
git diff --name-status branchname..develop
git diff --name-only branchname..develop
git diff --name-only HEAD^ | xargs mvim -p # useful for opening in multiple tabs
git diff --name-only --diff-filter=d HEAD^ | xargs mvim -p # Filter to ignore deleted files

Which tags include a particular commit:

git tag --contains 741326a842e8c3d443c2787980f2fe6e079ccb39

#Before Pushing

Squash branches as much as possible

git rebase -i master..

#Best Practices


  • No equivalent of hg copy




brew install hub

Disable 2factor temporarily

Open current repository in your browser

hub browse




  • Go is on GitHub, but they use Gerrit for code review


  • GitLab
  • Upsource
  • Phabricator
  • Critque (Used at Google)


  • Alot more tools.

    • Time Tracking, Milestones, Weight


  • Merge Requests

    • You can work on the commit message before merginging.


  • UI is sparse


Install vim-fugitive

Inside vim:

In command mode, will open a browser pointing to the file in GitHub


This works when lines are highlighted as well.