I wanted to revert all local changes with
git checkout -- .
but accidently did
git checkout - .
and it made lots of local modifications that I can't understand at all.
What does the second command do and is it possible to revert what was done?
git checkout -
checks out the previously checked out branch. So I would assume that git checkout - .
will replace the contents of the working copy with the contents of the previously checked out branch.
You can not undo that, but since you wanted to reset the contents of your working dir anyways, why don’t you just run git checkout -- .
?
You might want to use git reset --hard
in the future to undo all changes against the current branch. It also resets the index.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With