I created and checkout a branch "Deep" from the master branch. Master branch had some uncommitted changes at this point. While on the "Deep" branch, I checkout the last saved commit.
After that I checkout to "Master" Branch.
Using the checkout command overwritten all the unsaved changes on "Master" branch.
Is there any way I can retrieve the lost changes on "Master" branch which now has the code of the last saved commit. When I type the reflog command in terminal, I get the following information:
f3df3fe HEAD@{16}: checkout: moving from f3df3fee373a68b65543a952721a75b9765d321a to master
f3df3fe HEAD@{17}: checkout: moving from Deep to f3df3fee373a68b65543a952721a75b9765d321a
f3df3fe HEAD@{18}: checkout: moving from master to Deep
f3df3fe HEAD@{19}: commit: Node touch detection
aa47485 HEAD@{20}: commit: Area Manager Created
These are the commands that I used:
git checkout -b Deep (Switching from master to Deep branch)
git log (It gave me the list of all previous commits)
git checkout f3df3fee373a68b65543a952721a75b9765d321a (checkout last saved commit)
After this command, I get the following message in the terminal: "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 "
Then I list all the branches and checkout the master branch
git branch
* (HEAD detached at f3df3fe)
Deep
master"
git checkout -f master
Listing all the branches again here
git branch (Detached head is gone here which I assume contains the local changes)
Deep
* master
I hope I can retrieve the lost code from here. Any help would be greatly appreciated.