- Git SCM: Manual Pages — Reference for all commands.
- Git SCM: Book — The entire “Pro Git” book by Scott Chacon and Ben Straub.
Check your current user config:
git config --list
Update your user config:
git config --global user.name "Thomas A. Anderson" git config --global user.email "email@example.com"
Writing commit messages
Commit messages should be written in present tense.
<!-- Good --> Update the navigation <!-- Bad --> Updates the navigation Updated the navigation Updating the navigation
Undo unstaged work
Undo changes that have not been staged or committed to a file:
git checkout -- filename.txt
Undo last unpushed commit and keep changes in working directory:
git reset --soft HEAD^
Undo last unpushed commit and lose changes:
git reset --hard HEAD^
# Generate diff and save to file git diff --name-status [commit1] [commit2] > file.txt # Example git diff --name-status b521ddfd8064c622471e0dabc7db2cfcef536713 c300d0553a95c20317e1f35f998d76843ae97b35 > file.txt