When I run ‘git checkout’, I also want to delete all additional files that have been created after commit.
But I couldn’t find the way. Here is the thing I tested,
I created a directory test and made a file test/test.txt after I commit.
Then I run git add . and git checkout, but the new file and directory were not deleted.
Why the new files were still exist even though I put command git checkout as roll-back?
How can I go back to the stage completely?
Thank you for your time and reading my question.
check out this thread: How do I revert all local changes in Git managed project to previous state?
As Thr4wn notes,
git reset --hardwill solve your particular problem. However, as noted in the thread linked above, it will not remove untracked files: it removes your second file only because you previously ran git add .git clean -fdseems to be the solution that removes EVERYTHING you added after the commit (this means you will lose all those files).