if you are the lowest hierarchical level in a tree of development branches (i.e. a single person's working branch), then always rebase when you pull from higher levels of the hierarchy. If, however, you are not the lowest level (you are someone else's upstream), then merge.
- to pull, if you are at the lowest hierarchical level (you are not anyone else's upstream, and others are not pulling from you, or at least not much) and you are pulling from a higher hierarchical level: git pull --rebase
- equivalent if you are getting changes from a local branch: git rebase BRANCH
- to pull, otherwise: git pull
- equivalent if you are getting changes from a local branch: git merge BRANCH
- if "git rebase" screws things up and you want to go back to the way it was before: git reset --hard ORIG_HEAD
- if "git rebase" screws things up and you want to save a ref to te way things were before: git branch name_of_branch_to_save_prior_state_in ORIG_HEAD
- to list branches: git branch
- to switch branches: git checkout BRANCH
- to copy changes from another branch into your working directory: git checkout BRANCH -- .
- to "save a copy" of current state as a branch (but not change to the new branch): git branch NEW_BRANCH_NAME
- to branch off (same as previous but also change to new branch): git checkout -b NEW_BRANCH_NAME
- to throw out the index and working directory and revert them to a clean state: git reset --hard
- to throw out the index and working directory and revert them to a clean state and discard last commit: git reset HEAD^
- to throw out the index and working directory and revert them to a clean state and discard last two commits: git reset HEAD^^
- to undo last git reset: git reset ORIG_HEAD
- to delete a branch: git branch -D BRANCH
- to point the current branch at another commit: git reset COMMIT
- to point the current branch at another commit and throw out index, working directory changes: git reset --hard COMMIT
- to diff between a master (which has moved on since the common ancestor) and a branch, git diff master...BRANCH (git diff would make it look like BRANCH is subtracting all the stuff master added since the common ancestor)