1

In ~./gitconfig, I have

[alias]
lg1 = 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

In magit, when type ll, it will log differently.

Is there a way to add another keystroke combination (such as lL) in magit to do customization log as lg1 above?

1

It is possible to add additional commands to the log popup (or any other of its popup), but it would be far from trivial to implement your alias as a Magit command. It is not enough to pass the desired arguments to git, something then also has to parse the output. This is done in one of the darker corners of Magit, see magit-log-wash-rev. You would have to edit that function and add a new magit-log-*-re variable.

So no, in practice you cannot do what you want to do.

However you might not have to. Are you aware that you can show additional information in the margin, including the author and commit date? That seems to cover the additional information you want to display. See the documentation about the log margin.

| improve this answer | |
  • Thanks for your detail explaination! Though it is not doable currently, I find magit's la shows similar info as lg1 – Johnson Jan 14 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.