How do I make git alias for 'git gc' work

Viewed 168

For some reason I have to run git gc --prune=now almost every day before I run a git pull so I wanted to create a git pp alias that helps me run those two commands

I added this to the users .gitconfig file

[alias]
    pp = 'gc --prune=now && pull' 

but when I try to run it I get what it seems a sintax error, how do I fix this on windows 10

enter image description here

I have read this

but I dont see my mistake

1 Answers

Use a ! at start to indicate that bash has to execute the alias, not git itself.

Then, explicitly call git for your pull command :

git config alias.pp '!git gc --prune=now && git pull'

To use it in the .gitconfig file make sure you use double quotes ""

[alias] 
    pp = "!git gc --prune=now && git pull"
Related