Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a keyboard shortcut for stage lines in git gui?

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?

like image 675
Hamy Avatar asked Sep 18 '15 21:09

Hamy


People also ask

How do I use git gui?

Working with GUIStep 1: Download and install the latest version of Git for Windows. Step 2: Use the default options for each step in the installation. Step 3: Remove Git Bash Desktop Icon. Step 4: Go to Start > All Programs > Git > Git GUI and make a Desktop Shortcut.

How do I change directory in git gui?

GIT GUI Change Origin of Remote Repository – Solution:In your GIT GUI Remote Menu, choose Remove Remote > and select your 'origin' (it can be anything you named it earlier). Now you have no remote source origin link. You cannot fetch or push anywhere. Go ahead and add in your new remote origin.

How do I start git gui on Mac?

Basically all you need to do is type 'open . ' to open the current directory in Finder and then click the Git button to open up git gui.


1 Answers

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.

like image 57
weinerk Avatar answered Sep 20 '22 13:09

weinerk