Bug 465512 - Add Team -> Revert changes in working dir command (or an equivalent way to perform a hard reset with path from the Team menu)
Summary: Add Team -> Revert changes in working dir command (or an equivalent way to pe...
Status: REOPENED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 3.4.2   Edit
Hardware: All All
: P3 enhancement with 4 votes (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-26 18:17 EDT by Mauro Molinari CLA
Modified: 2016-03-24 06:20 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mauro Molinari CLA 2015-04-26 18:17:52 EDT
It seems like it's overly complicated to perform a "Revert" in eGit.
I'm using the "Revert" verb on purpose, because it seems to be the default in the "Team Provider" terminology. In git probably the most natural mapping of this concept is "checkout" or "hard reset" on a path.

In eGit I see that:
- in the Synchronize view there's the "Overwrite" command: IMHO, this label is not very intuitive, because you may wonder "with what" you're going to overwrite your file; "Revert" is much more clear, both because it's the term commonly used in other SCM providers in Eclipse and because it directly refers to a SCM operation ("overwrite" is usually used in copy operations instead)
- in the Team contextual menu of the navigator views there's no action at all that allows to do such an operation... I had to search the Internet to find out that the only way is to use the "Replace With" menu, which in the past I always used whenever I wanted to replace the contents with a specific revision/version of a file, not with the "last reference one" (which is the choice in at least 90% of cases...
So, I think that a Team -> Revert action should really be provided. If you don't like the idea to use the "Revert" verb, at least please use "Replace with HEAD" or "Hard Reset", which would at least be familiar to git users (much more than "Overwrite"...).
Comment 1 Matthias Sohn CLA 2015-04-26 18:59:05 EDT
Revert has a different meaning in git [1] hence this term is not appropriate for checkout or hard reset in EGit.

Replace with HEAD and hard reset are already available in EGit:
- click "Replace with > HEAD revision" for the first
- click "Team > Reset..." and choose reset type "Hard" for the latter

[1] http://git-scm.com/docs/git-revert
Comment 2 Mauro Molinari CLA 2015-04-27 03:34:32 EDT
I know there's "Replace with > HEAD", but as I said this is not the first place where such a function is searched for, since it's even outside the Team menu. Also, the confusing "Overwrite" label in the Synchronize view is still an issue IMHO.

I'll check for the presence of "Team -> Reset..." as soon as possible, because either I'm blind or I don't have it in my installation.

Or probably it is not present on a file selection because of this:
http://stackoverflow.com/a/1751286/1465635
that says that Team => Reset acts on ALL the files, not to a file selection (which is what I'm talking about here).

Also please note that the verb "Revert" is nevertheless used in other parts of Eclipse (the quick diff, for instance).
Comment 3 Matthias Sohn CLA 2015-04-27 03:52:50 EDT
(In reply to Mauro Molinari from comment #2)
> I know there's "Replace with > HEAD", but as I said this is not the first
> place where such a function is searched for, since it's even outside the
> Team menu. 

it's not in the team menu since other "Replace with" commands are already located outside the team menu, e.g. "Replace with > Local History..."

> Also, the confusing "Overwrite" label in the Synchronize view is
> still an issue IMHO.

then please file a separate bug for this problem

> I'll check for the presence of "Team -> Reset..." as soon as possible,
> because either I'm blind or I don't have it in my installation.
>
> Or probably it is not present on a file selection because of this:
> http://stackoverflow.com/a/1751286/1465635
> that says that Team => Reset acts on ALL the files, not to a file selection
> (which is what I'm talking about here).

right, at the moment EGit only exposes git reset on repository level, reset with path selection isn't implemented yet. If that's what you want reopen this bug and adjust the bug description or file a new bug.
 
> Also please note that the verb "Revert" is nevertheless used in other parts
> of Eclipse (the quick diff, for instance).

AFAIK those other parts aren't related to git functionality.
We try to strictly follow git terminology in order to avoid to confuse users which know native git.
Comment 4 Mauro Molinari CLA 2015-04-27 04:09:52 EDT
(In reply to Matthias Sohn from comment #3)
> it's not in the team menu since other "Replace with" commands are already
> located outside the team menu, e.g. "Replace with > Local History..."

I know why it is there, I'm just saying that it's not intuitive to not have such a BASIC Team feature in the Team menu.
See also the aforementioned StackOverflow question to see that I'm not the only one who could not easily find this and the reaction of other people to the appropriate answer (i.e.: to use "Replace With").

> right, at the moment EGit only exposes git reset on repository level, reset
> with path selection isn't implemented yet. If that's what you want reopen
> this bug and adjust the bug description or file a new bug.

I'll adjust the description here, although I think it was clear enough in the first place ;-)

> AFAIK those other parts aren't related to git functionality.
> We try to strictly follow git terminology in order to avoid to confuse users
> which know native git.

I understand your point of view, but since eGit is a Team Provider, I think that homogeneity in terminology with the other Eclipse Team features should also be taken into consideration. So, maybe a compromise could be explored.
For instance, if you call the menu action "Team > Revert local changes..." you shouldn't risk to confuse with the git "revert" command that substantially undos an existing commit, especially if this action brings a new dialog that says that a hard reset (or checkout) will be performed and asks for confirmation about which files you want to revert/hard reset.
Comment 5 Mauro Molinari CLA 2015-04-27 04:15:13 EDT
(In reply to Matthias Sohn from comment #3)
> > Also, the confusing "Overwrite" label in the Synchronize view is
> > still an issue IMHO.
> 
> then please file a separate bug for this problem

Opened bug 465540.
Comment 6 Mauro Molinari CLA 2015-04-27 04:19:49 EDT
(In reply to Mauro Molinari from comment #4)
> For instance, if you call the menu action "Team > Revert local changes..."

Ok, in git almost all is "local", what I mean is "changes in the working directory", of course. I updated the summary accordingly.
Comment 7 Andrey Loskutov CLA 2015-04-27 04:27:13 EDT
I think (might be I misunderstood it) there are some similar requests (see bug 418210, bug 384602) which all can be translated to:

"Please give us some easy way (menu) to revert whatever we select in the project to some meaningful previous state, without being git command line guru".

Honestly speaking, I also tried many times to search for some kind of "revert" menu under "Team", since "Replace With..." isn't that intuitive and not something one start to search for if one just want to revert local changes or throw away untracked temporary files.

So the proposal would be add "Team->Revert Local Changes" menu, which would:
 * checkout that selected element(s) (dir/file) if it is part of the tree
 * remove that selected element(s) (dir/file) if it is untracked

WDYT?
Comment 8 Mauro Molinari CLA 2015-04-27 04:39:48 EDT
(In reply to Andrey Loskutov from comment #7)
> So the proposal would be add "Team->Revert Local Changes" menu, which would:
>  * checkout that selected element(s) (dir/file) if it is part of the tree
>  * remove that selected element(s) (dir/file) if it is untracked
> 
> WDYT?

Yes, exactly this! Probably I would also add: if the selected element is tracked but new (i.e.: staged, but not in HEAD), remove it all the same (i.e. unstage and delete).
In other words, the equivalent of Subversive "Revert" command, which restores the state as if it were just checked out from HEAD.

I do not want to force a comparison between the two once again, but I think that what is good in Subversive should be recognized as such.
Comment 9 Matthias Sohn CLA 2015-04-27 04:53:07 EDT
(In reply to Andrey Loskutov from comment #7)
> I think (might be I misunderstood it) there are some similar requests (see
> bug 418210, bug 384602) which all can be translated to:
> 
> "Please give us some easy way (menu) to revert whatever we select in the
> project to some meaningful previous state, without being git command line
> guru".
> 
> Honestly speaking, I also tried many times to search for some kind of
> "revert" menu under "Team", since "Replace With..." isn't that intuitive and
> not something one start to search for if one just want to revert local
> changes or throw away untracked temporary files.
> 
> So the proposal would be add "Team->Revert Local Changes" menu, which would:
>  * checkout that selected element(s) (dir/file) if it is part of the tree
>  * remove that selected element(s) (dir/file) if it is untracked
> 
> WDYT?

ok "Revert local changes" sounds good for the described functionality and is clear enough to not confuse it with git revert
Comment 10 Markus Keller CLA 2015-04-28 08:39:17 EDT
See bug 384602 comment 7. EGit should just properly integrate with Eclipse and perform the "Revert" requested in comment 0 via Replace With > ...

Git-specific commands like "git checkout" can be added to the Team menu if you think EGit users would need them. There, they can also be properly named as "Checkout > ...".

EGit 4.0 would be a perfect target for such a fix.
Comment 11 Mauro Molinari CLA 2015-04-28 10:15:20 EDT
Thanks Markus. But I still think such a basic/natural feature should be available in the Team menu, too. On the other bug you say you have never needed this in your whole life, this really surprises me, it's one of the first basic things I felt the need for when started to use EGit. And of course I searched for it in the Team menu...
Comment 12 Peter Stöckli CLA 2016-03-24 05:38:08 EDT
Having worked with several Git clients and Subclipse, I still had to perform a web search to find out how to revert a single file with EGit, which was kind of embarrassing for me (I never left the 'Team' menu on said file in the 'Package Explorer' view when searching for a possibility).
I was relieved when I found an answer on StackOverflow with over 200 upvotes, because I seem to be not the only one with that problem/workflow.

(In reply to Markus Keller from comment #10)
> Git-specific commands like "git checkout" can be added to the Team menu if
> you think EGit users would need them. There, they can also be properly named
> as "Checkout > ...".

This would work for people that are already used to the Git lingo and would be an applaudable change. Problems remain with people that come from other IDEs where it's called 'Revert...' or from Subclipse.