Bug 326638 - Replace With -> Latest from HEAD / Another Branch or Version...
Summary: Replace With -> Latest from HEAD / Another Branch or Version...
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement with 2 votes (vote)
Target Milestone: 1.0.0   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
: 337285 (view as bug list)
Depends on:
Blocks: 293192
  Show dependency tree
 
Reported: 2010-09-30 03:39 EDT by Gunnar Wagenknecht CLA
Modified: 2012-10-20 17:56 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gunnar Wagenknecht CLA 2010-09-30 03:39:15 EDT
Sometimes I want to throw away any changes I made to an Eclipse project (or folder, or file). CVS offers a "Latest from HEAD" extension in the "Replace With -->" context menu. This includes replacing any modified or outdated files with latest versions from HEAD as well as removing any untracked files.

I figured that I could do similar things with Git using a combination of "git reset --hard" and "git clean -d -f" on the command line. After that "git status" comes back with "nothing to commit (working directory clean)".

I played with the "Replace With -> File in Git Index" option but it didn't seem to do anything. After invoking that on my project it still contained a lot of "dirty" files. Even "git status" showed a lot of modified files.
Comment 1 Gunnar Wagenknecht CLA 2010-09-30 03:42:34 EDT
A second "Replace With ->" option offered by CVS and related to this functionality is "Another Branch or Version...". This allows to pick a particular branch or version.
Comment 2 Chris Aniszczyk CLA 2011-02-15 16:16:15 EST
Initial work on this is here:

http://egit.eclipse.org/r/#change,2415
Comment 3 Kay Huber CLA 2011-04-07 10:58:27 EDT
How about adding a shortcut to "Replace with latest from HEAD" in the Team menu? From a workflow / usability perspective, to me it seems like a similar operation as "Commit" - only that it does the contrary thing. Current SVN implementations have both options: 
* Replace With > "Replace from repository" as well as 
* Team > "Revert"
Comment 4 Stefan Hansel CLA 2011-05-04 07:15:11 EDT
As a new user deciding to switch to Mercurial or Git (i.e. deciding that for my company), this thing here is one I stumbled about.

Every other Team-Provider has a 'Replace With ...' in the Team menu (in Mercurial named 'Revert ...') and that thats also where most users will look first.

I'm aware of the documentation (http://wiki.eclipse.org/EGit/User_Guide#Reverting_Changes) but people just are not used to 
a) look into the 'Replace With' menu and
b) are not sure, what 'Replace With -> File In Git Index' really means and if it is what they actually want (i.e. Replace With Head).

Being at JAX currently it was said you want user input for your final release, so here is my stab at making you aware what currently annoys me most in EGit and where I see Mercurial Eclipse integration superior from a usibility / low learning curve perspective.
Comment 5 Chris Aniszczyk CLA 2011-05-04 07:31:30 EDT
(In reply to comment #4)
> b) are not sure, what 'Replace With -> File In Git Index' really means and if
> it is what they actually want (i.e. Replace With Head).

Well, the Git index is a powerful concept that needs to be understood by your team. So hopefully by reading the thorough EGit User Guide, they can understand what the index is.

http://wiki.eclipse.org/EGit/User_Guide#Index

We spent a lot of time working on that guide, if something isn't correct, please let us know.

> Being at JAX currently it was said you want user input for your final release,
> so here is my stab at making you aware what currently annoys me most in EGit
> and where I see Mercurial Eclipse integration superior from a usibility / low
> learning curve perspective.

So would you be happy with simple a Replace With -> HEAD? I could see us supporting a 'Replace with -> Another Branch of Version' but people would have to understand the consequences of that.
Comment 6 Stefan Hansel CLA 2011-05-04 10:25:51 EDT
Hi Chris, 

>> So would you be happy with simple a Replace With -> HEAD? I could see us
>> supporting a 'Replace with -> Another Branch of Version' but people would have
>> to understand the consequences of that.

Yes - my typical use case is: 
'I went into the wrong direction, throw away my current local uncommitted changes, without much fuzz'

or in short as a menu
'Replace with ... -> 'latest from local branch'  (or 'current branch'?)  
This item would be selection sensitive.

The flexible version of that is 
'Replace with ...' -> 'another branch or version ..'
with a new dialog to choose from.
This item might only make sense on the whole tree (like 'Switch To')

Both CVS+Mercurial have these option in their 'Replace With' menu.
As I guess most people (unfortunately) don't read user manuals it's important to have labels that are not too git specific (like 'replace with file in git index', which can only be understood by reading manuals) but labels known from 'older' CVS/SVN eclipse plugins to make the adoption of git in companies much easier for those who have to/want to introduce it.

Mercurial IDE also offers a 'revert ...' option in the IDE to easily revert an unwanted (already committed) changeset (but that might be a new enhancement request).
Comment 7 Kevin Sawicki CLA 2011-05-05 21:11:49 EDT
Proposed fix pushed to: http://egit.eclipse.org/r/#change,3349
Comment 8 Robin Stocker CLA 2011-05-06 06:52:14 EDT
This command should also be able to restore deleted files (git reset HEAD file && git checkout FILE), which is currently impossible in EGit.
Comment 9 Chris Aniszczyk CLA 2011-05-06 10:10:34 EDT
(In reply to comment #8)
> This command should also be able to restore deleted files (git reset HEAD file
> && git checkout FILE), which is currently impossible in EGit.

I'd open another enhancement request for that one.
Comment 10 Chris Aniszczyk CLA 2011-05-06 10:28:01 EDT
This is now fixed with f15d35db7742d9a3f8f5492e0d66ebbd5e0962a5.

Thanks Kevin and everyone else.
Comment 11 Robin Stocker CLA 2011-05-06 13:09:28 EDT
  (In reply to comment #9)
> (In reply to comment #8)
> > This command should also be able to restore deleted files (git reset HEAD file
> > && git checkout FILE), which is currently impossible in EGit.
> 
> I'd open another enhancement request for that one.

Filed bug 345002 for this.
Comment 12 Robin Stocker CLA 2012-10-20 17:56:15 EDT
*** Bug 337285 has been marked as a duplicate of this bug. ***