Reputation: 33
I have a bunch of files in a directory, and will version several files among all.
My git history will then look like the following:
commit0: Initial empty commit
commit1: start versioning file a.txt
commit2: edit a.txt
commit3: start versioning file b.txt
commit4: edit b.txt
...
After a while, I want to rollback all my changes, and come back to the state of commit0.
However, doing git reset --hard commit0
will delete a.txt and b.txt
Is there a way to rollback all the changes but not delete the files that were added ?
Thanks,
Upvotes: 0
Views: 126
Reputation: 6719
Don't use --hard
.
from commit 4:
git reset commit0
git checkout commit1 -- a.txt
git checkout commit3 -- b.txt
Upvotes: 2