With this command:
git log --all -n30 --graph --abbrev-commit --decorate \
--date=relative --format=format:'%h - (%ar) %s - %an%d'
I will get a wonderful tree which is exactly what I am looking for except that the HEAD is not always on the top.
If I remove the --all
option, I will also lose all the displayed branches.
How can I keep both the HEAD on top and still see the full tree visible up to the last 30 elements?
In other words what I get is
* d4b7d5a - (foo)
* * 44f53e2 - (HEAD)
|/
* 4587f32 - (bar)
And What I want to get is:
* 44f53e2 - (HEAD) <- HEAD on the top
| * d4b7d5a - (foo)
|/
* 4587f32 - (bar)
These 3 items mean the following: HEAD -> master - Your current, local working copy of the repository is at this point and on the master branch. origin/master - Your remote master branch is also at this point. my-new-branch - Your local my-new-branch branch is also at this point.
The --decorate flag makes git log display all of the references (e.g., branches, tags, etc) that point to each commit.
Git Log Oneline The oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message.
Unfortunately I dont believe it is possible, since d4b7d5a(foo) commit was made after your HEAD. You could reverse the order of your log but thats not the point. The only way I know to leave HEAD always on top would be something like the option '--before' to display only the commits made before HEAD.
You can find more about --before and others filters here: https://www.atlassian.com/git/tutorials/git-log
Any way, you can find a similar question here: Git log --graph; HEAD to top
But there is no solution there either.
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