This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 227444

Summary: Add interactive/patch-level selection in git commit
Product: versioncontrol Reporter: tomacpace
Component: GitAssignee: Ondrej Vrabec <ovrabec>
Status: CLOSED INVALID    
Severity: normal CC: erit01, git, MacDada, markiewb, terje7601
Priority: P3    
Version: 7.3   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: screen capture of xcode source commit
Partial "git add" GUI suggestion

Description tomacpace 2013-03-14 01:03:48 UTC
Created attachment 132585 [details]
screen capture of xcode source commit

following back-and-forth twitter & email communication, I am logging this to request the finer-grain selection of what may be included during a git commit.

Attached is a screen capture of an example of selective commit elements within Xcode. This can be easily found after downloading Xcode, creating a new sample project with a git repository and then committing using File > Source Control > Commit.

Key elements: patch 3 has been unselected for commit, the little down-pointing triangle on patch 4 gives the contextual options of opt-in or opt-out, or fully discarding the patch.  Within the left-side pane, the file  has a line through the checkbox, indicating it's not an all-inclusive commit since #3 is not included. Otherwise, it'd be a checkmark, or empty checkbox if all changes are excluded.  There are more features within the Xcode IDE in this commit view, but those are the most commonly used.

I use these features within Xcode frequently.  And my usage of Netbeans is increasing, plus its visualization for version diff in Netbeans is excellent so a logical upgrade would be opting out of specific changes.


Following are relevent email messages:
---------------------------------------------------------------
FIRST MESSAGE
Hi Geertjan

I'm sending this message after you sent me a response twitter message.

After downloading, installing and quickly setting up Netbeans 7.3, I found one thing that I miss from another IDE is yet missing within 7.3.
Doing a Git Diff is great, especially visualizing the differences. People praise Netbeans over Eclipse for this ability, but it's about tie with Xcode (which I also use on a daily basis).  The git support built into Xcode provides the added ability of manually specifying which changes are included in a commit, a visual interactive git add during the commit process.  I use that feature almost 100% of the time when committing within Xcode, and makes commits much nicer, enabling me to avoid committing logging code but keep it live and active within the working tree.

That's just one micro part of Netbeans I know, but it's something that is worth mentioning, since Netbeans seems to be striving to be the top IDE for several platforms.

Thanks for your time.

-Tom Pace

---------------------------------------------------------------
SECOND MESSAGE

Thanks for the feedback. If i understand correctly the feature you're looking for is to be able to commit just a part of local modifications (not all) in a file, in other words commit not on the granularity od whole files but on a finer level of patch hunks. I've heard something about this feature in other versioning systems (namely Mercurial, see http://mercurial.selenic.com/wiki/RecordExtension) and there was a request to implement it in the IDE.
The best would be to file a RFE in BZ so we can keep track of it and monitor the number of users asking for it. Then we can decide on a plan to implement it.
http://netbeans.org/bugzilla/enter_bug.cgi?product=versioncontrol

Thanks,
Ondra
---------------------------------------------------------------
THIRD (FINAL) MESSAGE

Hi, thanks for responding/forwarding so quickly.

The feature is as you describe, a finer level than whole files.  

The following link describes this in detail.  The "Staging Patches" section at the bottom is particular about this feature. 
http://git-scm.com/book/en/Git-Tools-Interactive-Staging

I will consider filing in bugzilla as you suggest.
---------------------------------------------------------------
Comment 1 Ondrej Vrabec 2013-09-02 11:38:55 UTC
very difficult to implement in NB, but i guess we can try or at least evaluate how much work it would take
Comment 2 Ondrej Vrabec 2013-12-04 18:24:05 UTC
makes sense for Subversion too.
Comment 3 MacDada 2014-01-21 17:10:49 UTC
Created attachment 144222 [details]
Partial "git add" GUI suggestion

I don't know about NetBeans internals, but from the GUI point of view:
* NB diff window lists files – one can right-click on the file and select "add" to run "git add" on the file.
* NB diff window shows file's changes comparison – one could right-click on a change to "git add" only that part of the file.
Comment 4 hifi 2014-10-29 17:55:54 UTC
This is one of the things that I notice sometimes when I suddenly start doing bug fixes while I'm also in the middle of a bigger feature.

One possible suggestion how to implement this possibly easier is to do this in the Commit dialog itself.

The "Files to Commit" section has a checkbox for each file and you can do file level selection of the modifications you want to commit. Now, the diff option of each file opens the "Diff" tab and you have the same diff view as in the GUI suggestion.

In this view, you could exclude "hunks" as Git calls them using the same method as in the suggestion. Those sections would just drop off from the view - be it graphical or textual diff.

The special part of this would be that in the file listing the selection checkbox would be tristate. Selected is a full file, partially selected is with only partial hunks and a fully selected is with all changes. Toggling the checkbox *after* you have removed a hunk from the commit would unselect it completely and toggling it again would select the file completely.

This way you can quickly revert back to full changes and try again if you misclick. This also requires the least amount of UI changes even if the third checkbox state is shown differently as AFAIK there isn't a stock checkbox widget that does this.

Would this make it any easier for first implementation or is all of the harder work under the hood, like pulling only partial differences off a file?
Comment 5 Christian Lenz 2018-02-26 15:51:26 UTC
I will close it, because it will handled now at the JIRA board: https://issues.apache.org/jira/browse/NETBEANS-428. Please discuss it there for further information.