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?
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
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.
To finish there is a very powerful tool you could use if you are a command line lover like me: Tig
这将通过即将推出的 Git 2.21.0 支持的--pretty=format:%S
令牌成为可能。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.