Git Finding a delete file in history Find the file_path exactly git log --diff-filter=D --summary Find the hash commit git rev-list -n 1 HEAD -- <file_path> Create a new branch for n-last commits git checkout -b <branch-name> git branch -f master HEAD~3 Diffs and applying diff/apply commands git diff > <patchfile> # one way git apply <patchfile> # another harder way patch -p1 < <patchfile> The best patching Creating patches from each commit git format-patch HEAD~2 git format-patch -n2 Applying patches git am *.patch Show diff between master and a branch git checkout <branch-name> git pull git checkout master git pull git merge --squash <branch-name> git diff [--staged] Show commits from one branch git whatchanged master.. --format=oneline To clean git reset HEAD git checkout . Show ignored files git ls-files --others -i --exclude-standard