How do you add a change to the index? [message #688469] |
Fri, 24 June 2011 14:52  |
Eclipse User |
|
|
|
I'm a bit embarrassed to even have to ask this, but I can't even figure out the basic operation of how to add a change to the index. What's the egit equivalent of 'git add -i'?
The things I tried didn't help me; I pulled up the diff of a file, right-clicked on a change, nothing there. None of the icons on the diff page seemed to be related to adding something to the index.
What am I missing?
|
|
|
|
Re: How do you add a change to the index? [message #689937 is a reply to message #689692] |
Tue, 28 June 2011 11:59   |
Eclipse User |
|
|
|
Add to the index with the "Add" operation. You can get to that operation from the right-click menu under "Team". Or, better, customize your development perspective (Java, C++, whatever) to include the toolbar items from the "Git" command group. The '+" toolbar item is "Add". You'll also get toolbar items for Push, Fetch, Pull, Commit, Checkout, Rebase and Reset
You can also do adds as part of the "Commit" operation.
Finally, you can use the very handy "Git Staging" view to drag changes from the "Unstaged" box to the "Staged" box (or vice-versa).
|
|
|
Re: How do you add a change to the index? [message #691206 is a reply to message #689937] |
Thu, 30 June 2011 19:55   |
Eclipse User |
|
|
|
R Shapiro wrote on Tue, 28 June 2011 11:59Add to the index with the "Add" operation. You can get to that operation from the right-click menu under "Team".
But doesn't that do the special case of "commit every change in a file"? How do I convince it to let me choose which change to commit?
R Shapiro wrote on Tue, 28 June 2011 11:59
You can also do adds as part of the "Commit" operation.
Perfect - but how? That UI is completely baffling. It gives me lists of files, not changes. How do I pick which changes I want, without grabbing every change in a file? I feel like I'm just not seeing something really basic. Double-clicking on a file just brings up a Java diff window, with no way to commit individual changes that I can see.
R Shapiro wrote on Tue, 28 June 2011 11:59
Finally, you can use the very handy "Git Staging" view to drag changes from the "Unstaged" box to the "Staged" box (or vice-versa).
How? I see how to drag entire files, but no way to drag changes.
In the vanilla git gui, there's a three-pane interface: one pane has the unstaged files with changes, another pane has the staged files with changes, and the third pane shows the changes in the selected file. That third pane is the core of the gui that I use all the time, choosing which changes to put into the index. What I'm looking for is the equivalent of that for egit, and for me at least, it's really hard to find.
[Updated on: Thu, 30 June 2011 20:31] by Moderator
|
|
|
|
Re: How do you add a change to the index? [message #693454 is a reply to message #691383] |
Wed, 06 July 2011 10:02   |
Eclipse User |
|
|
|
The more I think about this, the more I'm convinced that egit really needs to support adding individual changes to the index.
After all, why are we using Git rather than, say, Mercurial? The latter has a much cleaner and simpler design than the high convoluted design of Git. Trendiness aside, there are a couple of good reasons we pay the price of Git's excessive complexity.
The first advantage is that native Git is very fast. That this is the most important win is clear from the standard subtitle "Fast Version Control System" appearing on books and in web sites. Unfortunately we're already giving up some of this in the egit world by its use of jgit. I haven't measured but my subjective sense is that egit is no faster than MercurialEclipse, whereas command-line Git is certainly faster than command-line HG.
In the Eclipse context that leaves one reason for using git, and therefore egit: very fine-tuned control. And what's the perfect example of this? Per-change indexing. You might even say that the fineness of control is what justifies the index: if commits are always on whole files, you don't need an index to organize them, you just need checkboxes to indicate which files you want to include in any given commit.
Conclusion: support for per-change index control in egit is crucial.
The gui aspect of this could be handled in several ways. For instance it could be added to the right-click menu of the quick-diff markers, since those are already per-change. Combine that with automatic display of the selected file in Git Staging view and you have a simple solution that doesn't require any new widgits.
Comments ?
|
|
|
|
|
Re: How do you add a change to the index? [message #706488 is a reply to message #704543] |
Sun, 31 July 2011 07:46  |
Eclipse User |
|
|
|
Following up on your second question: What else would you expect from a "per-change index control in egit"?
While the Compare With approach covers the functionality with a familiar Eclipse widget, it's maybe not the most intuitive way to do this.
Another possibility comes to mind: extend QuickDiff. I don't know how straightforward it is to add new functionality to the QuickDiff right-click menu, but that I think would be a very clean way to add/remove changes. Just as you can revert a block or a line from here, this seems like very natural place to be able to add/remove a block or a line to/from the index.
Similarly, the QuickDiff decorations could be extended to show lines or blocks that have been staged: it would really be nice to see in text editors which uncommited changes are staged and which aren't.
Summary: add 'stage' and 'unstage' operations and a 'staged' decoration to left-gutter QuickDiff items.
|
|
|
Powered by
FUDForum. Page generated in 0.16781 seconds