2

Whenever I type "git cherry-pick --continue", it always brings up an editor that I have to "ctrl-x" out of. This seems to resemble "git cherry-pick"'s "-e" option, which appears to be automatically enabled. I would like to disable it. Alternatively, I would like to have a line in my Python program that can "ctrl-x" out of it as soon as it pops up. How can I do this?

I'm running Python code which finds the commits a commit you want to cherry pick depends on. In the process, I run code that deletes the "<<<", "|||", "===" and ">>>" lines, as well as the stuff between "<<<" and "===" in merge conflicts caused by commits that need to be later be manually merged. This lets me continue cherry-picking other commits dependent on it:

 85             if commit in divergentCommits:
 86                 problems = divergentConflicts[commit]
 87                 for problem in problems:
 88                     fileName = problem[0]
 89                     problemFixes = problem[1]
 90                     for fix in problemFixes:
 91                         print "sed --in-place " + fix + fileName
 92                         os.system("sed --in-place " + fix + fileName)
 93                     os.system("git add " + fileName)
 94                     os.system("git cherry-pick --continue")
Darkfire
  • 21
  • 1

1 Answers1

0

You can always put GIT_EDITOR=/bin/true in the environment to disable all interactive requests.

o11c
  • 15,265
  • 4
  • 50
  • 75
  • Where should I put that line? I tried putting it in the .gitconfig file, but wherever I try to put it (e.g. in line 7), I get the error, "fatal: bad config file line 7 in /home/user/.gitconfig" when I try to cherry-pick. – Darkfire Jun 26 '15 at 22:59
  • Use `os.putenv`, or better stop using `os.system` and use `subprocess.Popen` instead. – o11c Jun 26 '15 at 23:08
  • I mean when I add "GIT_EDITOR=/bin/true" to the file .gitconfig, typing "git cherry-pick " into Terminal gives me the error, without using any Python code. Also, how are os.putenv and subprocess.Popen different from os.system? Currently I'm using os.system to write to the console and os.popen to write to the console and then read its output. – Darkfire Jun 26 '15 at 23:16