I'm writing a script for migrating git repos. On cherry-pick conflicts I run
git add .
git cherry-pick --continue
This brings up vim, prompting me to save the commit message and freezes the script. I am looking for a command-line option like --no-edit
or --porcelain
to get around this.
Ugly terminal hacks might be welcomed as well ;)
Change commit message when cherry-picking To change the commit message when cherry-picking, use “git cherry-pick” with the “-e” option. As illustrated in this example, your default editor will open and it will let you change the commit message.
As Zildyan said in his answer, you will need to resolve all the conflicts before doing git add
. Therefore, you should not make this fully automated.
That said, to skip editing the commit message, you can simply set your editor to a command that does nothing and reports success. The ideal one on Unix-like systems is the true
command. Hence:
git -c core.editor=true cherry-pick --continue
will do the trick. (You can also use any of the environment variables GIT_EDITOR
, VISUAL
, or EDITOR
; and in fact, if any of those are set, you must use them rather than core.editor
since the sequence is: use $GIT_EDITOR
if that is set; else use $VISUAL
if that is set; else use $EDITOR
if that is set; else use core.editor
if that is set; else use whatever is built in to this version of Git.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With