Git graph with ref logs
Posted
by
Francisco Garcia
on Stack Overflow
See other posts from Stack Overflow
or by Francisco Garcia
Published on 2012-11-18T09:56:08Z
Indexed on
2012/11/18
11:00 UTC
Read the original article
Hit count: 297
git
I am trying to improve my custom git log format string. I have almost everything I want except the ref names. I can already get a log similar to what I want:
> git log --all --source --pretty=oneline --graph
* b7c7ad3855b54e94ad7ac03f2d2e5b96d6e5ac1d refs/heads/b1 na
| * 695e1482622a79230fa1d83afb8d70e86847334a refs/heads/master Merge branch 'b1'
| |\
| |/
|/|
* | ec21f370f82096c0208f43b390da234d92e8c74a refs/heads/b1 beta
* | c6bc1f55ab3b1bd568493a5de4298dfcb4f66d8d refs/heads/b1 alfa
* | 762dd868ae87753afc1cbf9803744c76f9a9e121 refs/heads/b1 tango
| * 57fb27bff06ee9bb569f93ba815e9dcd69521c13 refs/heads/master little last post commit
|/
| * 8d613d09b43152a7263b6e02d47ec8a4304f54be refs/heads/b3 the other commit
| * e1f32b7cb86633351df06e37c2c58ef3f9fafc40 refs/heads/b3 something
|/
| * 01b5c6728cf25dd576733211ce75dd3ecc29c7ba refs/heads/b2 this time a
I am fighting to get a customized output with my own format string like this:
> git log --pretty=format:'%h - %gD %s' --source -g
b7c7ad3 - HEAD@{0} na
ec21f37 - HEAD@{1} beta
01b5c67 - HEAD@{2} this time a
01b5c67 - HEAD@{3} this time a
695e148 - HEAD@{4} Merge branch 'b1'
57fb27b - HEAD@{5} little last post commit
My main problem is that I cannot get the ref names I want. I assume it is one of the %g? format strings, but none of them seem to give me the full ref name.
Another problem is that the %g? format strings are empty unless I walk the reflogs (-g). However git refuses to combine --graph with -g
How can reproduce the first sample with a format string which I can further customize?
© Stack Overflow or respective owner