Setup git globally:

git config --global user.name "Oliver Twist"
git config --global user.email "oliver@twist.com"

List global configuration

$ git config –global –list

http.proxy=http://your-proxy-data/
http.sslverify=false
https.proxy=http://your-proxy-data/
user.name=Oliver Twist
user.email=oliver@twist.com
color.ui=true
alias.st=status
alias.ci=commit
alias.br=branch
alias.co=checkout
alias.df=diff
alias.dc=diff --cached
alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
alias.bra=branch -a
core.editor=/usr/bin/vim
core.autocrlf=input
core.safecrlf=true
core.eol=lf
merge.renamelimit=10000
remote.origin.fetch=+refs/pull/*/head:refs/remotes/origin/pr/*
credential.helper=cache
push.default=simple

Ignore folders

A .gitignore file should be committed into your repository, in order to share the ignore rules with any other users that clone the repository.

GitHub maintains an official list of recommended .gitignore files for many popular operating systems, environments, and languages in the github/gitignore public repository.

If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later.

Convert files

unix2dos -D filename or dos2unix -D filename

Situation: Be able to run codesniffer on pull request source repository on github

Add this line to your ~/.gitconfig

git config --global --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pr/*"

From now on you can see the open pull requests

git remote show origin
Username for 'https://github.com': username
Password for 'https://username@github.com':
* remote origin
  Fetch URL: https://github.com/xxx/xxx-reference.git
  Push  URL: https://github.com/xxx/xxx-reference.git
  HEAD branch: master
  Remote branches:
    master           tracked
    refs/pull/1/head new (next fetch will store in remotes/origin)
    refs/pull/2/head new (next fetch will store in remotes/origin)
    refs/pull/3/head new (next fetch will store in remotes/origin)
    refs/pull/4/head new (next fetch will store in remotes/origin)
    refs/pull/5/head new (next fetch will store in remotes/origin)
    refs/pull/6/head new (next fetch will store in remotes/origin)
    refs/pull/7/head new (next fetch will store in remotes/origin)
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (up to date)

You need to figure out which one is the one you need to check from github: I discovered is pr/3

$ git fetch origin
# 3 is the number of pull request
$ git checkout pr/3
Branch pr/3 set up to track remote ref refs/pull/3/head.
Switched to a new branch 'pr/3'
$ git log -3 --oneline
24cb690 Remove dependencies
3c5d7b8 Latest changes
4b3d9ce 2.1 version
(@pr/3)] ~/www/github/ho-reference

## Situation: Cache your credentials for git so you don’t have to re-enter it too many times

Since Git 1.7.9 (released in late January 2012), there is a neat mechanism in Git to avoid having to type your password all the time for HTTP / HTTPS, called credential helpers.

 $ git config --global credential.helper "cache --timeout=3600"