Question : how to undo a modified file in git
Answered by : daniel-hemmati
# If you want to revert the changes only in current working directory
git checkout -- .
# discard anything (note: you have to be in the directory
# where all of the changes are located)
# or you can use the command on line 9, you can discard anything
# on the repo
git checkout -- *
git checkout -- :/
# or if you check the git status message after modifying a file
# there is this command
git restore <file>
Source : https://stackoverflow.com/questions/5807137/how-to-revert-uncommitted-changes-including-files-and-folders | Last Update : Tue, 31 Mar 20
Question : discard unstaged changes git
Answered by : proud-peafowl-2jk1nmg04l9b
#For all unstaged files in current working directory use:
git checkout -- .
#For a specific file use:
git checkout -- path/to/file/to/revert
Source : https://stackoverflow.com/questions/52704/how-do-i-discard-unstaged-changes-in-git | Last Update : Fri, 16 Oct 20
Question : git reset change in one file
Answered by : oldfashioned-ox-x414f1a9h2wx
# undo local changes to specific file
git checkout -- file
Source : https://stackoverflow.com/questions/692246/undo-working-copy-modifications-of-one-file-in-git | Last Update : Sun, 30 Aug 20
Question : git discard changes to one file
Answered by : david-diamant
git checkout -- file
Source : | Last Update : Tue, 10 Aug 21
Question : git discard unstaged files
Answered by : kasmin
git stash save --keep-index --include-untracked
Source : | Last Update : Tue, 09 Jun 20