Skip to content

Instantly share code, notes, and snippets.

@PsyChip
Created January 10, 2018 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PsyChip/46dfca8c3d2def49ee7a13c0938bf8c4 to your computer and use it in GitHub Desktop.
Save PsyChip/46dfca8c3d2def49ee7a13c0938bf8c4 to your computer and use it in GitHub Desktop.
sync local updates with remote git clone via single command
#!/bin/sh
###########################
cd /c/dev/psy-blog.git
# pushing committed updates first
git push
# standard procedure
git add .
echo type message..
read commitMessage
git commit -am "$commitMessage"
# push to git remote repository
git push ssh://ubuntu@127.0.0.1:/var/git/blog.git
# pull at remote server
ssh ubuntu@127.0.0.1 "sudo sh -c 'cd /var/www/html && /usr/bin/git pull'"
###########################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment