Git Flashcards
Git: how can you go back to where you have started?
git rebase –abort
Git: how can you show the files of the recent commit?
git show
Git: how to show the commit refs in oneline format?
git log –pretty=oneline
Git: how to delete anything about a file in history?
git filter-branch –index-filter ‘git rm -r –cached –ignore-unmatch ‘ HEAD
Git: how to compare two branches?
git diff branch1..branch2
Git: how to show diff of file (not added or uncommitted for example)?
git diff filename
Git: how to reset single file to head?
git checkout filename
Git: how to undo add of file?
git reset filename
Git: how to change previous commit message?
git commit –amend
Git: how to take local files when merging conflicts?
grep -lr ‘«««
Git: how to mark all conflicted files as solved?
git add -u
Git: how to checkout a specific commit for a single file
git checkout ### filename
Git: how to show log to single file?
git log filename
How to show log with short commit hashes?
git log –abbrev-commit
Git: how to search for commits in history related tp a single file?
git log -S’xxx’ – filename.y