1

I checkout to previous commit and then accidentally added and commit on that commit, now when i checked out to dev branch my work vanished, how can i retrieve my work

enter image description here

the commit on which i checked out displaying as ((741a...) and then i git add . and git commit the commit changes ((5b78c...)

blackHawk
  • 6,047
  • 13
  • 57
  • 100

1 Answers1

0

Simply use git reflog: that will give you the last commit you just did before switching branches.

Then cherry-pick said commit to your current dev branch, as seen here, using git cherry-pick:

git cherry-pick <commitSHA>
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250