I need a simple way to quickly check a branch and commit three. So I went to the Git documentation and found this:
git log --pretty=format:"%h %s" --graph
Output:
* 2d3acf9 Ignore errors from SIGCHLD on trap
* 5e3ee11 Merge branch 'master' of https://github.com/dustin/grit.git
|\
| * 420eac9 Add method for getting the current branch
* | 30e367c Timeout code and tests
* | 5a09431 Add timeout protection to grit
* | e1193f8 Support for heads with slashes in them
|/
* d6016bc Require time for xmlschema
* 11d191e Merge branch 'defunkt' into local
However the actual output in CLI looks like this
git log --pretty=format:"%h %s" --graph
Output:
* 2d3acf9 Ignore errors from SIGCHLD on trap
* 5e3ee11 Merge branch 'master' of https://github.com/dustin/grit.git
* 420eac9 Add method for getting the current branch
* 30e367c Timeout code and tests
* 5a09431 Add timeout protection to grit
* e1193f8 Support for heads with slashes in them
* d6016bc Require time for xmlschema
* 11d191e Merge branch 'defunkt' into local
I can achieve what I need by using this command:
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
But as you can see, it's too long and easy to type when in a rush. I can't always use an alias to shorten it.
What is wrong with git log --pretty=format:"%h %s" --graph
?
I need to run this mainly on Windows in PowerShell, but also on Linux in terminal.
What didn't help me:
Git graph not showing branch. This is fixed by changing the way how the user works with commits. Not helpful.
How to read a Git log graph. This simply explains how to read the
--graph
output.