User:Saper/Random notes

Rules

 * 1) Gerrit is a tool to master a single commit. It is not a tool to review branches of patches
 * 2) Don't automatically create new commits with git merge or git cherry-pick. git cherry-pick -n (don't commit) and git merge --ff-only are fine
 * 3) Understand index and git add
 * 4) Try to understand basics how git commit --amend works.

Problems

 * I got lost where am I?: Use "git branch -avv"
 * What's up with my working tree:Use "git diff" to find out changes not yet scheduled for commit. Use "git diff --cached" to see what your commit will be. Use "git status" for overview of those.
 * What just happened?: Use "git reflog" to find out what are your last changes
 * How do I go back?: If your commit is wrong you can --amend it or "git reset --soft HEAD^" to reset your working tree and index to the state just before the commit.

Pitfalls

 * 1) Multiple "git remotes"
 * 2) Cause problems with "git review"
 * 3) Cause problems with "git pull"
 * 4) Multiple local branches
 * 5) Using "git branch -vv" or "git branch -avv" to find out where you are
 * 6) People lost when rebasing changes
 * 7) Make them understand that HEAD and branches are just moving pointers
 * 8) Show how "git reset --hard" and "git reset --soft" can be useful
 * 9) Using "git reflog" to find your way