Is there any way to show source while using pretty=format?
Im getting information on which track specific commit was pushed by command
git log --source --oneline
But I also need a date=short which I see cannot be used together with --oneline. But can with pretty=format. Problem is that I don't know how to show --source in pretty=format, can you help?
-
This posted 15 min ago. Related maybe? Hmmm..... not really.Romain Valeri– Romain Valeri2019年02月22日 10:39:29 +00:00Commented Feb 22, 2019 at 10:39
-
Well, I have to have --source informationElcardia– Elcardia2019年02月22日 10:44:00 +00:00Commented Feb 22, 2019 at 10:44
2 Answers 2
You should take a look at this post. It gives a very nice exemple of a customize git log. And also an oneliner to define it with a Git alias.
To try it, you can type:
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
To define it in an alias:
git config --global alias.lg "git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
To use it :
git lg
To check your configuration:
git config alias.lg
To remove it:
git config --unset alias.lg
date=short
If you want to go further in the configuration, you should look at the Git pretty-formats documentation (placeholders section).
For the date you were talking about, you could change the %cr by %ad because this format respects the --date=option. So you could use --date=short as you want.
Tig
To finish there is a very powerful tool you could use if you are a command line lover like me: Tig
1 Comment
This will become possible with the --pretty=format:%S token supported in the upcoming Git 2.21.0.
2 Comments
--pretty=format:%S. You are probably talking about the subject placeholder %s: --pretty=format:%s.