I have an issue with using Git through the terminal. I was ready to add my changes to the branch and commit them. And I messed it up and lost all my changes before I could get them back. Here's the command I ran.
git checkout name
Update 6 paths from the index (This is where I lost all my changes.)
git checkout -b name
git status (This is when I found all my changes were gone.)
I forgot to add the -b in the checkout but I don't think missing the -b should have done anything. Then I tried
git reflog
1234e (HEAD -> name, origin/master, origin/HEAD, master) HEAD@{0}: checkout: moving from master to name
1234e (HEAD -> name, origin/master, origin/HEAD, master) HEAD@{1}: checkout: moving from master to name
1234e (HEAD -> name, origin/master, origin/HEAD, master) HEAD@{2}: checkout: moving from master to name
1234e (HEAD -> name, origin/master, origin/HEAD, master) HEAD@{3}: checkout: moving from master to name
I then tried to checkout via the 1234e and still no luck on getting my changes back and even went further back to the an earlier one and look luck on that one either. So far the internet has run up dry for this problem. I hope I still have my changes, I really don't want to do the work again as it's a few hours worth of work. Anyone have an idea to get my changes back?
Thank you!
question from:https://stackoverflow.com/questions/65943989/git-checkout-behavior