Snobby Snobby - 1 year ago 48
Git Question

"Git pull" on server after every "git push" from local machine

My usage of git is very simple.
Basically I do smth like this on my local machine:

echo 'Update' >>
git add . && git commit -m 'update' && git push -u origin master

Then on server:

git pull

That's it.

And I am doing it every time I make changes on my local machine.
Seems to me I can optimize this somehow, but I haven't found any git command to deal with this.

Is there a way not to print
git pull
every time there is a change?
And maybe there is a way to automatically
add && commit && push

Answer Source

For the second thing you can create a script.
Eg. edit file /usr/local/bin/git-update as root, paste git add . && git commit -m 'update' && git push -u origin master, then sudo chmox +x /usr/local/bin/git-update and use your new command (git-update).