3

Doing this:

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

as mentioned on a Windows machine just gives me this error:

usage: git config [options]

when I try running git hist. Any suggestions why it doesn't work?

Zombo
  • 1
  • 62
  • 391
  • 407
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

3 Answers3

5

I could not pick up the command to add hist alias to git. But I am directly insert it into .gitconfig file that usually can be located at "C:\Users\<login name>\" or "C:\Documents and Settings\<login name>\".

Look at fragment of my .gitconfig file, and note the changes to be made to the hist alias so that it worked fine under Windows.

[alias]
    co = checkout
    ci = commit
    st = status
    br = branch
    hist = !git --no-pager log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
    type = cat-file -t
    dump = cat-file -p
fedorch
  • 441
  • 4
  • 9
0

PowerShell is doing funny stuff with the last argument. You can stop this like so

git config --global alias.hist --% 'blah blah blah'
#                              ^
#                             / 
#                  notice ----

Powershell command line parameters and '--'

Community
  • 1
  • 1
Zombo
  • 1
  • 62
  • 391
  • 407
0

Use double quotes:

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