When trying to capture git output stream to a file some of the output printed on the screen doesn't make it to the file.
to reproduce:
git show -s --oneline
the output on the console should be something similar to this:
1580ab93 (HEAD -> branch/name) some commit message
but when try to redirect the output to a file like this:
git show -s --oneline > file.txt
the output that get redirected to the file is just this:
1580ab93 some commit message
Can someone who knows the reason why this happens elaborate more and maybe suggest a solution or a workaround to be able to capture the full output from the command to my file.
Note: my final reach is to capture the output from a python script not just to a file.
Thanks
git show -s --onelineis2b202ce (HEAD -> master, origin/master, origin/HEAD) commit messagebut the content oftmp.txtaftergit show -s --oneline > tmp.txtis2b202ce commit message.--output=<file>option worked. For example:git show -s --oneline --output="./tmp.txt"process ='s line would beprocess = subprocess.Popen(['git', 'show', '-s', '--oneline', '--decorate=short'], stdout=PIPE, stderr=PIPE), but I'm not sure and I can't test it. You shouldn't need thebranchvariable in that answer.