Reputation: 1427
I am working with SourceTree and I would like to reset all changes I have made in my working copy.
For some tests, I created three Java class files, a new one, one which I have updated and a last one which I have removed from my working copy:
New.java
Update.java
Remove.java
Reset All works fine for the updated and the deleted class file but not for the new one:
After the reset I have to remove the New.java
class manually:
Summarized:
After Reset All the updates on the Update.java
file were gone and the removed Remove.java
file were restored. Perfect! The only thing I didn't understand is why I have to remove the new New.java
file manually? Could it be that I have some missunderstanding?
Thanks in advance!
Upvotes: 0
Views: 684
Reputation: 2050
If New.java is a new file that has never been staged, git reset would never delete that file as git does not know what to do with it. Effectively, New.java is an untracked file and git won't do anything to this file until you add it to the stage.
Upvotes: 1
Reputation: 38734
I don't know SourceTree, but I guess 'Reset All' is like doing git checkout .
which will revert all tracked files like you described. To remove untracked files, the command-line equivalent would be git clean -f
or if also directories are affected git clean -fd
and to also include files ignored by .gitignore
and similar git clean -fdx
. So I guess you search for a Clean All
option in SourceTree to get rid of untracked files.
Upvotes: 4