git revert a file code example
Example 1: git discard local changes
git checkout -- <file>
git reset --hard
Example 2: how to undo a modified file in git
git checkout -- .
git checkout -- *
git checkout -- :/
git restore <file>
Example 3: git revert one file
git checkout HEAD -- /directory/my-file.txt
Example 4: how to remove file changes in git
git clean -df
git checkout -- .
Example 5: git reset one file
git checkout HEAD -- my-file.txt
Example 6: reset certain file git
git checkout c5f567 -- file1/to/restore file2/to/restore