Reputation: 395
What goes on here? Why are the two outputs different?
$ git log --oneline -n1
7dbee6d (HEAD -> master, origin/master, origin/HEAD) some commit msg
$ git log --oneline -n1 | head
7dbee6d some commit msg
The piping to 'head' was the simplest example I could find to illustrate the problem. The problem prevents me from e.g.:
system:
Upvotes: 2
Views: 46
Reputation: 2890
From the log
manpage:
--decorate[=short|full|auto|no] Print out the ref names of any commits that are shown. If short is specified, the ref name prefixes refs/heads/, refs/tags/ and refs/remotes/ will not be printed. If full is specified, the full ref name (including prefix) will be printed. If auto is specified, then if the output is going to a terminal, the ref names are shown as if short were given, otherwise no ref names are shown. The default option is short.
So when called with --decorate=auto
, the behavior will change depending whether stdout is a terminal or not. If you pipe git log
output somewhere, stdout
will not be a terminal.
The default is short
, but you may have auto
somewhere in your git options.
To get the same behavior in both cases, call it with --decorate=short
Upvotes: 1