Alias for git is configured into the file .git/config
:
[alias]
publish = !sh ./scripts/publish.sh
The script file ./scripts/publish.sh
looks like this:
#!/bin/sh
set -e
git push user@remote:path/to/clone/
ssh user@remote 'cd path/to/clone && git checkout -q -f'
Now it can be published by simply executing git publish
.