Snapshotting Flashcards
How do you stage all changes for commit?
git add .
How do you commit staged changes with a message?
git commit -m “Commit message”
How do you view the status of your working directory and staging area?
git status
How do you show the differences between the working directory and the last commit?
git diff
How do you unstage a file while retaining the changes in the working directory?
git reset HEAD filename
How do you amend the last commit with new changes?
git commit –amend
How do you restore a file from the last commit to the working directory?
git checkout – filename
How do you create a commit that includes changes from all tracked files?
git commit -a -m “Commit message”
How do you show the changes staged for the next commit?
git diff –cached
How do you list all the files that are being tracked by Git?
git ls-files
How do you stage a portion of a file’s changes?
git add -p filename
How do you show the changes made by the last commit?
git show
How do you commit all changes in the working directory with a message?
git commit -am “Commit message”
How do you revert changes in the working directory to the last commit?
git checkout .
How do you display the history of a file including renames?
git log –follow filename