I'm following the git tutorial at gitimmersion.com and set up an alias hist
to show a custom pretty log output.
When I disable git's pager (setting GIT_PAGER to nothing or to cat
), the output omits the newline at the end.
Here's what I see:
work/lab_10$ git hist
* 88976c6 2011-01-19 | Added a comment (HEAD, v1, master) [Jim Weirich]
* b819ef8 2011-01-19 | Added a default value (v1-beta) [Jim Weirich]
* ff07fc9 2011-01-19 | Using ARGV [Jim Weirich]
* b73dc5c 2011-01-19 | First Commit [Jim Weirich]work/lab_10$
Notice that the shell prompt shows up after the last character of printable output, with no newline.
To compare, here's what I see when using a standard pretty format:
work/lab_10$ git log --pretty=oneline
88976c644e65afa697b58fc940eb8f94c47f8129 Added a comment
b819ef832effdaea8c0e33b1fea36ea4071c61b9 Added a default value
ff07fc93d3e2e5522e5607c9952cbad10cfa1144 Using ARGV
b73dc5c1579756f4e9a4f91a90384c47288023b0 First Commit
work/lab_10$
In this case, the newline prior to the next prompt appears.
Here's the definition of the alias:
[alias]
hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
Is there a way to tell git log
to include the final newline when I'm not using a pager?
Try
hist = log --pretty="tformat:\"%h %ad | %s%d [%an]\"" --graph --date=short
format
places newlines between commits, tformat
places newlines after each commit, thus also after the last one.
See git-log(1) for details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With