How to make a simple revert work on Git / EGit?

52,875

Solution 1

In my version "Replace With..." -> "HEAD Revision" seems to be doing just that...

It's not in the "Team" submenu, which is a bit confusing, I admit..

Also, this might help : Eclipse git checkout (aka, revert)

Solution 2

Go to the "Synchronize" view (if you don't have it opened, it's in "Window" / "Show View"), populate the list in case it's not loaded, right click the file you want to revert and in the context menu select "Overwrite" to revert to the latest file in the Git server.

You can also check the changes you're going to discard before reverting by selecting "Open In Compare Editor" in the context menu.

Solution 3

You can get "Replace with Head Revision" from "Git Staging"

enter image description here

Share:
52,875

Related videos on Youtube

JohnPristine
Author by

JohnPristine

I hope I could help.

Updated on June 17, 2020

Comments

  • JohnPristine
    JohnPristine almost 4 years

    Ok. Simple things should be simple, so I hope it is. :)

    I have changed a file, now I want to revert back to the latest version in the git repo because my changes are crap and I want to start fresh again changing the file.

    As far as I am concerned you should do this:

    git checkout -- <NAME OF FILE>

    First question: How to do this inside eclipse with EGit? There is no checkout option under team. :( :( :(

    Now let's suppose I have multiple files modified in multiple directors. How do I revert all of them to start fresh again?

  • JohnPristine
    JohnPristine about 11 years
    SVN shows you what you are about to revert. Replace does NOT. Awesome git!
  • Stef
    Stef over 8 years
    Yep, it works and it is logical ... just not as user friendly as in IntelliJ for example.
  • killjoy
    killjoy almost 7 years
    Nice, but still not as intuitive as IJ.
  • killjoy
    killjoy almost 7 years
    Too warped a solution IMO. Have to enable Sync view, then load the view, then select destination from a list - not as intuitive or less clicks as other responses and definitely not as nice as in IJ.