0

I've hard reset to a particular commit. After do that my changes are gone. Can I get back my changes in git?

I'd following steps.

git reset --hard [commit id]
git push origin [branch name] --force
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
Vasi
  • 1,147
  • 9
  • 16

1 Answers1

2

enter image description here As @William mentioned, reflog should do the trick Look at the image above of git reflog. I followed the following steps:

  1. First commit
  2. second commit
  3. Hard reset to first commit
  4. Force push the changes.
  5. Next, git reset 83a0402 which is the sha for the second commit.

You should be able to see your changes now

AbhinavD
  • 6,892
  • 5
  • 30
  • 40