Git Flashcards
Start tracking a folder
git init
The name of the git directory inside the current folder
.git
Check your current status
git status
Add a new file to be tracked
git add
Add all modified files to be tracked
git add .
Git will unstage its version of committed file but keep mine
git rm –cached
Command to update how git works
git config
Update username
git config –global user.name “Name”
update email
git config –global user.email “Email”
List all commits git is currently tracking
git log
Shows list of files included in the commit in git log
git log –stat
Show list of files included in git log (not stat flag)
git lob –name-only
Command for where git stores the global config file
cat ~/.gitconfit
Add all files with a certain file ending
git add ‘*.rb’
git preferred way to remove tracked file
git reset HEAD
Git will remove my copy of the file and stage the removal of its copy
git rm
Does the opposite of whatever commit you specify. Stages the result. (w/o flag git will automatically commit the undo.)
git revert -n
Continue a git revert
git revert –continue
Abort a git revert
git revert –abort
Lets you pull files from any previous commit even if they were later deleted or destroyed
git checkout
go back to the last commit
git reset
find every file it knows about and “overwrite” it with the last version committed
git reset –hard
Git will protect you only __________. Any untracked files can be lost
up to the last commit
remove a file from the untracked location
rm … just rm no git