I want to create a sh
script that configures all my git aliases. Some of the aliases have pipes (|
) and doublequotes ("
). The output I want to see in my ~/.gitconfig
file is:
[alias]
assume = update-index --assume-unchanged
unassume = update-index --no-assume-unchanged
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
However, running the following three commands yields an incorrect assumed
entry:
# setup git aliases per: http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/
git config --global alias.assume "update-index --assume-unchanged"
git config --global alias.unassume "update-index --no-assume-unchanged"
git config --global alias.assumed '"!git ls-files -v | grep ^h | cut -c 3-"'
The third alias (assumed
) has undesired backslashes:
assumed = \"!git ls-files -v | grep ^h | cut -c 3-\"
What is the correct syntax to configure the alias via command line?
You don't need double quotes in .gitconfig.
So the command is:
git config --global alias.assumed '!git ls-files -v | grep ^h | cut -c 3-'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With