EGit Iteractive Adding

So what is “interactive adding” in git? Imagine situation when you change two or three lines in file (this could be also two or three blocks/methods), then you realize that you will want to commit those changes in two (three or more) separate commits.

What about EGit? Honestly this is currently supported … but it isn’t really straight forward to access. You need to select a file then choose from context menu Team > Compare With > Git Index and then you can easily move changes around, finally when you are happy with both versions (left is working tree and right is one that will be staged/added to index) just save compare editor contents. Version from right hand side will be added to index as it is in this editor.

OK, so now you can easily stage and unstage partial changes … maybe you would also like to partial replace staged changes by version in HEAD? Currently in version 1.1 you can compare version from git index with HEAD version using context menu Team > Compare With > Git Index with HEAD, but you cannot overwrite anything … yet, because (hopefully) in 1.2 such option will be available. Here is patch that adds this functionality (to be honest this is a side effect…).

And what about (my favorite) Synchronize View? Unfortunately EGit 1.1 don’t allow to move any changes in compare editors launched from Synchronize View … but with change mentioned above and with this one both features would be available from Git Commits model (before it was named as Git Change Set model)

@Carsten
Working with Gerrit is little bit tricky. You (and yours team) need to find theirs own patch-size, because if you post very small patches that connects into huge change-set-chain you’ll end up with rebase/cherry-pick hell. On the other hand working with huge patches review process can take ages …

Hey Darius, two quick questions:
– Do you know if there is any ETA for 1.2 ? Also
– Also, it is possible to add both patches to an EGIT 1.1 version or do I have to wait? The stage hunk\line part for me is essential and having that ability is one of the reasons I’m still not fully on EGIT, but using EGIT + GIT Gui

I can stage partial changes using this method, but can I commit them in EGit? When I tried, I had to select the file, and all the changes in the file got committed. Is there a way to do this without going to the command line? My version of EGit is 2.2.0.