

Sharing my git cheat sheet - martin-adams
http://martinadams.tumblr.com/post/37209901794/git-cheat-sheet

======
robmil
For the "create a local branch from a remote branch", a more sensible option
is probably:

    
    
      git checkout -t origin/branch-name
    

Other things that are useful:

Push and track a branch at the same time:

    
    
      git push -u origin foo
    

Merge a branch and always generate a merge commit, even if a fast-forward was
possible:

    
    
      git merge --no-ff foo
    

A condensed and useful status output:

    
    
      git status -sb
    

Useful `git log` options:

    
    
      --abbrev-commit
    

(Shows as short a commitish as possible)

    
    
      --color-words
    

(Show word-level diffs in the same line, rather than as two whole -/+ lines)

    
    
      --decorate
    

(Where a commit is also a ref (e.g. the latest commit on a branch), display
that ref in the output)

~~~
martin-adams
Awesome, thanks for the tips. I'll be sure to update the cheat sheet with the
wealth of community knowledge!

------
isxek
Some common Git aliases would probably be a good addition, e.g., "git cm" for
"git commit -m", or "git lol" for "log --graph --decorate --pretty=oneline
--abbrev-commit".

~~~
martin-adams
Well what can I say, I hadn't come across git aliases before and looks to be
very handy.

