-1

I'm having heart attack right now. A month ago I'm clonned a commit to master, and when I was opening PowerShell console, I was seeing

C:\Workspace\Project [(abcd12...)]>

Today I commited changes and ran command

git checkout master

I have missed it with another command and thought it will place changes to master, but it replaced old content with new.

Is these a way to find last commit and put it to my disk and master? Thanks!

Henrik Gustafsson
  • 47,070
  • 9
  • 44
  • 59
Ivan
  • 331
  • 3
  • 14

1 Answers1

1

To see a list of the historical changes to your repository, you can use git reflog

You can then do git show <commitish> to find the commit you want to restore and do a git reset --hard <commit> or a git checkout <commit> to any of the commits listed in the reflog.

Henrik Gustafsson
  • 47,070
  • 9
  • 44
  • 59