1

I've made a massive mistake and deleted several files directly on my remote repository. I pulled these changes thinking I would only be pulling the still present files, however I lost all the files on my local repository that I had deleted on the remote one. This caused my maven project to break and I couldn't do anything with it anymore. Is there any way to revert my changes?

Stephen C
  • 632,615
  • 86
  • 730
  • 1,096
Glanyx
  • 159
  • 1
  • 1
  • 9
  • In the _History_ view right-click the commit before the commits you pulled and choose _Reset > Hard_. – howlger Aug 12 '18 at 14:52

1 Answers1

0

General idea:

If your local files were committed, you can reset everything to before the git pull:

git reset --hard HEAD@{1}

See git reflog to make sure HEAD@{1} is the right commit.
See an example here.


For Eclipse itself, you can go first to the reflog view

https://wiki.eclipse.org/images/e/e3/Egit-1.2-reflog-view.png

Then you can right-click on a past commit, and select "Reset > Hard"

VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • This answer requires the installation of the Git command line to execute a single command that can also be executed via EGit. – howlger Aug 12 '18 at 14:59
  • @howlger True: I have edited the answer accordingly. – VonC Aug 12 '18 at 15:03
  • I realized I completely forgot to mark this as answered. Reflog really helped, thanks so much. – Glanyx Sep 27 '18 at 13:07