If I type the following into Terminal I can accomplish everything I want:
git commit -am "my commit message" ; git pull ; git push ; ssh user@server 'cd /path/to/git/repo/ ; git pull ; exit'
I'd like to create the same as an alias in my ~/.zshrc
. Something like:
alias pushit () { git commit -am "$@" ; git pull ; git push ; ssh user@server 'cd /path/to/git/repo/ ; git pull ; exit' }
To be run in Terminal like so:
pushit "my commit message"
Instead every time I reload ~/.zshrc (source ~/.zshrc
) or open a new Terminal window I see it loop through my alias dozens of times. It's not clear it actually runs.
What am I doing wrong?
Notes:
- This is not for a mission critical server. It's just for personal use. I know it's poor form.
- I'd rather not use git's [alias] tools so I can keep all of my aliases in the same place (
~/.zshrc
).