This has intrigued me this morning when I attempted to set a git alias by using
git config --global alias.ac '!sh -c "git add . && git commit -m $0"'
But it failed to work after git ac "Finish static pages"
due to the error
fatal: Option -m cannot be combined with -c/-C/-F/--fixup.
It still gives me a headache after searching around. Why can't I combine -m option with sh -c
and how should I do correctly to make this work? Much appreciated!
Edit If I use
git config --global alias.ac '!sh -c "git add . && git commit -m $1"'
instead of $0
in the end, it will say
sh: git add -A ; git commit --message Finish static pages: No such file or directory
fatal: While expanding alias 'ac': 'sh -i "git add -A ; git commit --message $1"': No such file or directory
I think I am looking for a way to accept an string instead of single word argument, maybe?