Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a complex git alias

Tags:

git

I'd like to set up a git alias which, upon git log would run

git log --pretty=format:"%C(yellow)%h  %C(red)%an, %C(green)%ar %""s" 
           --since=2.weeks –n20

I tried running

git config --global alias.log 'log --pretty=format:"%C(yellow)%h  
           %C(red)%an, %C(green)%ar %""s" --since=2.weeks –n20'

And confirmed that it is recorded in .gitconfig as

 28 [alias]
       …
 34   log = log --pretty=format:\"%C(yellow)%h  %C(red)%an,
                 %C(green)%ar %\"\"s\" --since=2.weeks –n20

This however does not format git output as expected.

What am I missing please?

like image 295
James Raitsev Avatar asked Dec 26 '12 22:12

James Raitsev


1 Answers

From git documentation:

To avoid confusion and troubles with script usage, aliases that hide existing git commands are ignored.

You'll have to rename your alias.

like image 100
max Avatar answered Nov 05 '22 15:11

max