When you just want to start fresh, you can always re-clone the repo. However, if you have local feature branches hanging around, then you may just want to clean up a particular branch.
If you do a git status, you will see two sections. One is unstaged local changes (before commit), the other is local untracked files.
For unstaged local changes (changes to files already checked in before)
[code] # discard and save changes for possible re-use git stash
# discard changes of a file
git checkout
# discard all changes to all unstaged local files git reset –hard [/code]
After you run the above commands, the untracked files will still stay put. It’s annoying if you have a long list of files/directories.
[code] # to see what would be removed (just preview) git clean -n
# to remove them git clean -f
# or do the usual rm -rf <file | dir> [/code]
ref: https://docs.gitlab.com/ee/topics/git/numerous_undo_possibilities_in_git/ https://koukia.ca/how-to-remove-local-untracked-files-from-the-current-git-branch-571c6ce9b6b1