简体   繁体   中英

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

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?

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)

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.

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

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM