git show <commit> --oneline not showing oneline
Asked Answered
P

2

25

I am using version 1.8.3 of mysysgit and it seems that the --oneline command does not give me just one line per commit, I get all of the diff lines as well.

git show HEAD --oneline

and even git show HEAD --pretty="%h %s"

do not give just one line.

(note: same results using both git bash and posh git)

The reason I want the show --oneline is I want to pipe the results of a rev-list query into it from posh git.

git rev-list <somestuff> | %{git show $_ --oneline}
Pearlinepearlman answered 21/6, 2013 at 0:52 Comment(1)
add --no-patchSucy
P
30

I think this'll do what you want git show --no-patch --oneline

Persist answered 7/7, 2019 at 3:19 Comment(3)
haha - this is a very old question - but yes you are right :-)Pearlinepearlman
--no-patch! that's the flag I was looking for, thanksBlock
This should be the accepted answer. Only for complementing the @Persist answer, the --oneline is working, but the diff output (think it as git diff) is still getting printed. So you see the commit meta data in one single line but the block of changes is printed below it. Then comes the --no-patch option which supress the diff output, accordingly to the documentationPittman
A
16

May

git log HEAD --oneline --no-walk

is what you want.

BTW, there is --pretty and --oneline the same as git log in git rev-list, maybe the pipe is unnecessary.

Arapaho answered 21/6, 2013 at 1:36 Comment(2)
the answer does not however explains why git show HEAD --oneline does not produce an output as stated in the documentation: <sha1> <title line> This is designed to be as compact as possible.Clairclairaudience
But why isn't it an one-liner :P ?Distasteful

© 2022 - 2024 — McMap. All rights reserved.