Git Setup Cheatsheet

Cover image

I had to setup several new machines during the past few months and at some point I got tired googling for the same websites every time I have to set up GIT. So I decided to write my Git Setup Cheatsheet:

Git Configuration

My identity:

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

My editor:

$ git config --global core.editor "atom --wait"

Git Terminal Shortcuts

Add to .gitconfig in my home:

[alias]
  co = checkout
  ci = commit
  st = status
  br = branch
  hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
  type = cat-file -t
  dump = cat-file -p

A more up-to-date version of this file can be found in this gist.

Git Commands and Branch Names Auto-completion:

Get the auto-completion script:

$ curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash

Set it up in my .bash_profile:

if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

GitHub Keyboard Shortcuts

https://help.github.com/articles/using-keyboard-shortcuts

Add SSH to GitHub

https://help.github.com/articles/generating-ssh-keys

Sources: