# add filesgit add .# diff all the changes to a filegit diff --staged > ~/mijn-fix.diff# remove local changesgit reset && git checkout .# (later you can re-apply the diff:)git apply ~/mijn-fix.diff
$ git status# Not currently on any branch.# Changes to be committed:# (use "git reset HEAD <file>..." to unstage)## modified: doc/PROJECT/MEDIUM/ATS-constraint/constraint_s2var.dats# modified: doc/PROJECT/MEDIUM/ATS-constraint/parsing/parsing_s2var.dats## Changes not staged for commit:# (use "git add <file>..." to update what will be committed)# (use "git checkout -- <file>..." to discard changes in working directory)## modified: doc/PROJECT/MEDIUM/ATS-constraint/constraint_s2Var.dats# modified: doc/PROJECT/MEDIUM/ATS-constraint/parsing/parsing_s2Var.dats
git clean -dxn . # dry-run to inspect the list of files-to-be-removedgit clean -dxf . # REMOVE ignored/untracked files (in the current directory)git checkout -- . # ERASE changes in tracked files (in the current directory)