Show the full command when executing a Git alias?

As an example:

log-1 = "!sh -c 'echo \"Full command: git log --graph --decorate --pretty=oneline --abbrev-commit\"; git log --graph --decorate --pretty=oneline --abbrev-commit' -"

You call the shell and execute the given commands.

In your lg example, you would have to do a whole lot of escaping as you have quotes inside qoutes and characters that need to be escaped. I suggest you create your own pretty format and use that in the alias. Let;s assume we call your format mine. This is what you need to do:

git config --add pretty.mine "%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset"

and the alias would be

lg = "!sh -c 'echo \"Full command: git log --graph --pretty=mine --abbrev-commit --date=relative\"; git log --graph --pretty=mine --abbrev-commit --date=relative' -"


Another option is the command ideas listed in the Git wiki section on Aliases wich gives, for the alias section of .git/config

[alias]

    aliases = !git config --get-regexp 'alias.*' | colrm 1 6 | sed 's/[ ]/ = /'

This then lists all your aliases as command lines.

Tags:

Git

Git Config