git clear local file code example
Example 1: how to clear git status
git rm -r --cached .
Example 2: git discard local changes
# Discarding local changes (permanently) to a file:
git checkout -- <file>
# Discard all local changes to all files permanently:
git reset --hard
Example 3: how to undo git clean -fd command
git clean -fdxn