-1

I have mistakenly delete last commit using:

git reset --hard HEAD^

There is any process to get the previous data.

phd
  • 82,685
  • 13
  • 120
  • 165
Shivam Gupta
  • 163
  • 2
  • 14

2 Answers2

1

You didn't delete the last commit; you merely reset the current branch to point to that commit's parent. git reflog will tell you what you previously had checked out; you can simply git reset --hard back to that commit.

Patrick Stevens
  • 569
  • 3
  • 17
  • Thank you. I have committed multiple files with the same messages. how to remove those commit from others? @Patrick Stevens – Shivam Gupta Jul 09 '20 at 14:00
1

Check out git reflog, which allows you to see the commits that are not referenced by any branch. It is well explained by this SO answer

alemangui
  • 3,571
  • 22
  • 33