I rolled back to previous commit using git checkout "commit number1"
. Then i didn't realize i was on commit and not on any branch so i made changes here and committed the code in "commit number1"
.
Now i switched to feature branch. feature/branch1
and i don't see any code.
If i switch back to "commit Number1"
, i don't see the code there either.
Am i detached from anything?
$ git checkout 49da8b4d431
Note: checking out '49da8b4d431'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
How can i recover the code? WHere did my code go?