Reputation: 163
Suppose I have 3 text files ours.txt, base.txt and theirs.txt and want to do a three way merge on them. When I call git merge-file -p ours.txt base.txt theirs.txt
in Git Bash, it will print the merged text.
Whereas, when I run
import subprocess
dir = "path/to/text files"
cmd = ["git", "merge-file", "-p ", "ours.txt", "base.txt", "theirs.txt"]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, cwd=dir)
I can access stdout
and stderr
through
(out, error) = p.communicate()
But can't seem to store the merged text that gets printed in Git Bash in a variable.
Does anybody have any ideas on how to retrieve it?
Thanks in advance.
Upvotes: 1
Views: 495