-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
  • 51,180
  • 9
  • 47
  • 60
Ivan
  • 361
  • 3
  • 16
  • Possible duplicate of [Revert Git repo to a previous commit](http://stackoverflow.com/questions/4114095/revert-git-repo-to-a-previous-commit) – Nick is tired Mar 25 '16 at 14:18
  • I would have a look at: http://stackoverflow.com/questions/4114095/revert-git-repo-to-a-previous-commit, but you are looking for git revert , followed by another checkout – Nick is tired Mar 25 '16 at 14:19

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
  • 51,180
  • 9
  • 47
  • 60