Is there a git command to revert all uncommitted changes in a working tree and index and to also remove newly created files and folders?
A safe and long way:
git branch todelete
git checkout todelete
git add .
git commit -m "I did a bad thing, sorry"
git checkout develop
git branch -D todelete
git clean -fd
didn't help, new files remained. What I did is totally deleting all the working tree and then
git reset --hard
See "How do I clear my local working directory in git?" for advice to add the -x
option to clean:
git clean -fdx
Note -x
flag will remove all files ignored by Git so be careful (see discussion in the answer I refer to).