In the standard git gui, there are options to stage selected lines or stage hunk. I find myself using these options constantly, but each time I have to right click, which can be tricky on a touchy work laptop trackpad. Is there a keyboard shortcut for the 'stage selected lines' functionality?
Here is a solution:
Open this file:
c:/Program Files (x86)/Git/libexec/git-core/git-gui.tcl
Add the following:
bind . <$M1B-Key-d> stagelines
proc stagelines {} {
apply_or_revert_range_or_line %X %Y 0
# for older versions of git-gui, use this line instead:
#apply_range_or_line %X %Y
do_rescan
}
Restart git-gui
Now you can highlight the lines and hit CTRL-D to stage them.