GIT Flashcards
How to discover which files have been changed since the last save?
git status
How to see what changes have been made to the files?
git diff
How to see which changes have been made to a specific file in a git directory?
git diff data/test.py
How to add a file to the staging area?
git add test.py
How to compare the state of files with those in the staging area?
git diff -r HEAD
How to commit with a message?
git commit -m “message”
How to see the git log of only one file?
git log filepath
How to see all changes in a specific file?
git annotate report.txt
How to remove an untracked file?
git clean -f filename
How to stage a file?
git add path/to/file
How to unstage a file?
git reset HEAD
How to undo changes that weren’t staged yet?
git checkout path/to/file
How to unstage a file?
git reset path/to/file
How to list the last two changes of a file?
git log -2 path/to/file
How to restore a certain version of a file?
git checkout [first few has values] path/to/file