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?
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
didn't help, new files remained. What I did is totally deleting all the working tree and then
See "How do I clear my local working directory in git?" for advice to add the
-x
option to clean:Note
-x
flag will remove all files ignored by Git so be careful (see discussion in the answer I refer to).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
Use "git checkout -- ..." to discard changes in working directory
or
removes all changes made to unstaged files in git status eg
One non-trivial way is to run these two commands:
git stash
This will move your changes to the stash, bringing you back to the state of HEADgit stash drop
This will delete the latest stash created in the last command.You can run these two commands:
I usually use this way that works well: