I'm going to hold a Git study session on November 14th. This gist is just a personal memo.
git diff --cacheduse this everytime before commiting in order to avoid tiny careless mistakes.git diff --name-only | xargs grep 'word-you-want-to-search'grep "word-you-want-to-search" among changed files.git log -10 --graph | lessshow quick history.git stashand (git stash poporgit stash apply) you should use them to switch branches.git rebase -ito edit history.
- See cached file and none-cached files using
git reset <filename>andgit add <filename>. Usegit diff,git diff --cachedandgit status. When a staged file is deleted, its cache would be still there. Dorm <filename>without usinggit rm. And then dogit reset HEAD <filename>. The file would go away. - Specifing a directory would point to all files in the directory. Use
git add,git reset HEAD,git diffto see the effect.