I'm trying to follow the instructions in this answer, to create an alias for a wordy git command:
Edit your .gitconfig file to add this snippet:
[alias] ignored = !git ls-files -v | grep "^[[:lower:]]"
I have two questions:
- Where can I find
.gitconfig
on Mac OS X? - How can I do this from the command line?
Following the simple instructions here, I have tried...
git config --global alias.ignored "ls-files -v | grep '^[[:lower:]]'"
and
git config --global alias.ignored "!git ls-files -v | grep '^[[:lower:]]'"
The first command is successful, but then git ignored
produces no output. The second tells me I'm doing it wrong.
Edit: here is what happens when I run this second command:
$ git config --global alias.ignored "!git ls-files -v | grep '^[[:lower:]]'"
git config --global alias.ignored "git push -u origin --all ls-files -v | grep '^[[:lower:]]'"
$ git ignored
Expansion of alias 'ignored' failed; 'git' is not a git command
After this command, the .gitconfig file contains...
[alias]
ignored = git push -u origin --all ls-files -v | grep '^[[:lower:]]'
... which does not look like he command that I thought I was setting.