Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Resetting a specific file
Resetting a specific file [message #759029] Fri, 25 November 2011 11:39 Go to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Hello,

I made some modifications on a file, but I don't want to commit them, and want to revert it to the version stored on the remote server (which may be newer that the file I originally got).

In Subversive, it was the "Override and update" command.
In EGit, I found the Reset command, but it seems to be applyable only to the full project.

What should I do ?

Thanks.
Re: Resetting a specific file [message #759052 is a reply to message #759029] Fri, 25 November 2011 15:39 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
You can't revert directly to with another repository but you can revert a file to its state as of the last fetch or pull from that repository. This is supported by the "Replace With..." operation, with the remote-reference as the target. This is usually something like 'origin/master' under "Remote Tracking". Replace With can also be used to revert to the last locally committed version, or the last staged but not yet committed change, or some other local branch.

Note that this is a completely local operation in all cases. In particular it will not fetch any new changes from a remote repository. That's a separate operation.
Re: Resetting a specific file [message #759321 is a reply to message #759052] Mon, 28 November 2011 06:25 Go to previous messageGo to next message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Thanks.

I would have liked to be able to do that from the "Team Synchroniez" view.
Re: Resetting a specific file [message #759348 is a reply to message #759321] Mon, 28 November 2011 08:09 Go to previous messageGo to next message
Dariusz Luksza is currently offline Dariusz Luksza
Messages: 40
Registered: July 2010
Member

As R Shapiro said you can use "Replace With" in eg. package explorer context menu.

You can also use "Overwrite" from file context menu in Synchronize view in "Workspace" presentation model. The "Overwrite" in Synchronize view is equivalent to "Replace With" -> "HEAD revision" from package explorer file context menu and it will restore version latest version of given file in this branch. If you would like to restore version from another branch you need to use "Replace With" -> "Branch, Tag, or Reference..." and then select source branch.
Re: Resetting a specific file [message #759352 is a reply to message #759321] Mon, 28 November 2011 08:24 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
The nightly build has an 'Overwrite' option in the Synchronize view. I don't know for sure what the semantics are here, in particular where it will overwrite from the HEAD, the Index, or the last commit fetched from whichever remote you're synchronizing against. One of the egit authors can no doubt answer that question.

Either way, I think you'll find it more straightforward to perform operations like this from an Explorer view using 'Replace With'. It's a bit roundabout to go through the work of synchronizing if you already know exactly what you want to do. Certainly 'Replace With' is much more explicit about what it will be doing.

In general I've noticed a tendency for Eclipse users to go through synchronization for no particular reason. This is true with subversive/subclipse and cvs, as well as egit. Unless you want to do detailed comparisons of multiple files, there's no reason in any Team provider to pay the price of synchronization.





[Updated on: Mon, 28 November 2011 08:28]

Report message to a moderator

Re: Resetting a specific file [message #759449 is a reply to message #759352] Mon, 28 November 2011 12:29 Go to previous message
Harry Houdini is currently offline Harry Houdini
Messages: 131
Registered: February 2010
Senior Member
Thank you, guys, it seems you provided me all the needed info.
Previous Topic:Pull fails in both Jgit API and EGit eclipse plugin
Next Topic:Collaboration and excluding files
Goto Forum:
  


Current Time: Fri Aug 29 10:18:12 EDT 2014

Powered by FUDForum. Page generated in 0.01983 seconds