This command omits the final newline: git log --format=format:"%H" check with: `| tail | cat -A` This command doesn't, but there is an extra newline between each line of course: git log --format=format:"%H%n" This seems to be intentional in the code, a newline is printed before each line except the first: https://github.com/git/git/blob/master/log-tree.c#L664 It seems more correct to print a newline after every line, but the code is very hairy so I am keen to get any feedback before attempting that. Thanks