Home Navigation

Wednesday 31 October 2018

How to clear local working directory (untracked) all manually added files

To reset a specific file to the last-committed state (to discard uncommitted changes in a specific file):
git checkout thefiletoreset.txt
To reset the entire repository to the last committed state:
git reset --hard

will remove untracked files

git clean -d -x -f 
-d directories
-x files ignored by git
-n for dry-run
-i interactive mode
-f force
-X Remove only files ignored by Git. This may be useful to rebuild everything from scratch, but keep manually created files.

No comments:

Post a Comment