# Commits ```bash # Use a basic GUI. Actually works quite well for staging hunks that can't be split. git gui # See what has changed/etcetera git status # See how many files have changed (insertions/deletions) git diff --stat | tail -n1 # See what or how many files are staged. git diff --cached --stat git diff --cached --stat | tail -n1 # Difference. Use Shift + Q to quit. git diff # Difference, ignoring space changes (EOL and multiple into one). git diff -b # See what changed in a file that's already been staged. git diff --cached # Add/stage a new/updated file. git add # Add/stage multiple files, space delimited git add # Add a file with prompts on what to do with hunks git add -p git add --patch # Add/stage all changes with prompts on what to do with hunks. git add -p # Add/stage all changes (including deletions) git add -u # Add/stage file deletion. git rm # Add/stage file move/rename (such as case sensitive change) git mv -f # Add/stage directory rename. git mv # Unstage change. git reset HEAD # Unstage all changes. git reset # Selectively unstage changes to files. git reset -p # Work in Interactive mode. git add -i # Discard changes to a file git checkout -- # Selectively discard changes to a file git checkout -p # Get a file from a particular commit. git checkout a1b2c3 -- # Get a file from the commit previous to the commit. Helpful if you want to revert a change just made to a file. git checkout a1b2c3~1 -- # Commit with Message. git commit -m "Message" # Commit with a summary and detail. Additional -m parameters can be passed as needed. git commit -m "Summary" -m "Details" # Update the last commit's message. git commit --amend -m "Message" # Update the last commit's date (reflected on GitHub). git commit --amend --no-edit --date="Fri Nov 6 20:00:00 2016 -0600" # Add another file to the last commit. Uses the last message. git add git commit --amend -C HEAD # Add all changed files and commit. New files are not committed. git commit -am "Message" # Show changes made in a particular commit. git show # Show the message and files from a particular commit. git show --stat # See a list of files that have changed in the current branch, compared to master. Includes number of files and inserts/deletes. git diff --stat master... git diff --stat master... # See the number of changed files, and how many inserts/deletes there were in a branch, since master. git diff --shortstat master... # See a list of just the file names that were changed in a branch, since master. git diff --name-status master... ```