Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Hist Alias Problems

Tags:

git

I'm working through the gitimmersion and creating alias [plural]. Everything worked except my hist.

$ git config --global alias.hist log --pretty=format: '%h %ad | %s%d [%an]' --graph --date=short

this takes me to the .config page, but doesn't create an alias

I know the code works (the part that I am making an alias for) because when I run

$ git log --pretty=format: '%h %ad | %s%d [%an]' --graph --date=short

it does the task I want.

Any ideas for making the alias work

like image 490
IdeoREX Avatar asked Apr 08 '26 18:04

IdeoREX


2 Answers

You need some "" there to get everything passed through properly:

git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"

In addition, I think you have an extra space between format: and the format string in both of your examples.

like image 136
Carl Norum Avatar answered Apr 11 '26 06:04

Carl Norum


you've missed off '--add' and git doesn't like the space between format: '%h (at least on my mac)

try:

$ git config --global --add alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short"
like image 39
mproffitt Avatar answered Apr 11 '26 07:04

mproffitt