Although the title seems similar to previous questions, I could not find the solution to to my Simple case:
- I committed to my branch ‘ABCD’ :
git commit -a ..... - Then decided to visit a previous commit so :
git checkout 2387687326487 - Here I made some changes which was for testing purpose only, and I don’t want to keep them
- I am done, I want to get back to my latest commit(again:ignoring changes whcih i made to the old commit) : the command
git checkout 'ABCD'gives error:
Your local changes to the following files will be overwritten by checkout….please commit or stash…
while I don’t want to commit or stash or whatever. I just want to go back home 🙂 what should I do please?
If you are sure that you don’t want to keep your changes, the following line will do :
Option ‘-f’ stands for force.