What's the best way to use "git add -p" in emacs on Windows?

Problem:

  • git add -p

    seems unusable in emacs, shell

    oreshell

  • magit

    (an often suggested alternative to using git from the shell in emacs) sucks balls out on Windows (it's awfully slow).
  • Keeping the cygwin window open and using that for git add -p

    and then going back and forth between them and emacs is doable, but more than a little annoying.

Is there a way that under Microsoft Windows I can get either git add -p

to work well in shell or eshell, or alternatively use it magit

for usability?

+3


source to share


2 answers


If magit is slow, it probably indicates a problem with your git client window?

I would look at this first (because it git add -p

doesn't really contain candles for the magit interface, IMO).



What are the exact tools (and versions) that you are using?

You should definitely check the tracking for the magit issue to see if there are any known reasons why magic might be slow.

+1


source


You tried:

% EDITOR=emacsclient git add -e <files>

      

and then using diff-mode commands in your emacs launches to interactively edit patch chunks?



You will then be able to split the chunks within the patch on any particular line with, diff-split-hunk

and completely remove the chunks with diff-hunk-kill

(and of course these commands are tied to shorter key sequences for quick interactive use). When you're done editing the patch, use C-x #

to save it and exit your emacsclient session (so you can return to your shell).

(emacsclient, if you are not familiar with it, is a program that will allow you to open files in already running emacs, if the latter started the server to connect emacsclient, see M-x describe-function server-start

)

Note that you probably want to customize how emacsclient interacts a bit with git; for example see the following answers: Using ediff as git mergetool and How to set exit status for emacsclient .

+1


source







All Articles