I need to switch to an older commit to check an older functionality of our program that has been later removed.
For that I checkout the corresponding commit:
git checkout 367af0345d0b09ab3ade1c7856462f68e5eafe86
Then I change some code about this deprecated functionality. But this is just for checking I want to ignore all of them.
Now the verification is done I want to come back to the latest working code:
git checkout master
But unfortunately I get a warning that sounds bad:
git checkout master
Checking out files: 100% (281/281), done.
Warning: you are leaving 183 commits behind, not connected to
any of your branches:
367af03 message
e5eee29 message
6999d77 message
... and 179 more.
If you want to keep them by creating a new branch, this may be a good time
to do so with:
git branch new_branch_name 367af0345d0b09ab3ade1c7856462f68e5eafe86
Switched to branch 'master'
Indeed I want to keep the last 183 commits but I don't want to create a new branch, just come back to the state I was before reverting temporarily...
The thing is that now these 183 commits are actually present in my code so they have not been lost like the warning suggests.
What did I miss?