Search code examples
gitzsh

Percentage symbol at the end of git log --pretty=format


When I run

git log --pretty=format:%s -1

I get this feedback:

Merge branch 'feature/416_NewTemplate' into develop%  

A percentage symbol, black text on white background, appears at the end for some reason. I can't find why. I removed all my gitconfig aliases because I thought it came from there, no change.

It is not inside my commit's message because the percentage symbol appears at the end of all commits :

git log --pretty=format:'%s' -2
Merge branch 'feature/416_NewTemplate' into develop
ft(#416/NewTemplate): resolve merge conflict%  

No percentage symbol when I try

git log --pretty=short

Git version 2.17.0 on Windows babun shell zsh.


Solution

  • That % is zsh indicating that the last line of output wasn't properly terminated (no newline). See also http://zsh.sourceforge.net/Doc/Release/Options.html#Prompting.

    As described in man git-log, you probably want --pretty=tformat:%s, not format:.

    • tformat:

      The tformat: format works exactly like format:, except that it provides "terminator" semantics instead of "separator" semantics. In other words, each commit has the message terminator character (usually a newline) appended, rather than a separator placed between entries. This means that the final entry of a single-line format will be properly terminated with a new line, just as the "oneline" format does.