'Git to move head back to latest commit [duplicate]
I have used Git to view some older files using the git checkout <hash> command.
However, now I want to move the head back to the latest commit without saving the changes I did at the older files.
Could you help on how to do that?
Solution 1:[1]
You did not explain you needs, so I am trying to guess...
Try with:
git reset --soft HEAD~1
# or
git reset --soft <COMMIT_ID>
Rembember --soft leave changes as uncommitted in order to inspect without loosing them.
Replace it with --hard if you need to discard them.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Antonio Petricca |
