Last active
September 25, 2020 17:39
-
-
Save heaversm/102fb3b41d18396291275243217e0f9c to your computer and use it in GitHub Desktop.
Github Commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Clone and checkout a single github branch | |
git clone --single-branch --branch <branchname> <remote-repo> | |
#delete all local branches matching pattern | |
git branch | grep "mh/#*" | xargs git branch -D | |
#set up git post-receive hooks for autodeployment | |
#source: https://www.digitalocean.com/community/tutorials/how-to-set-up-automatic-deployment-with-git-with-a-vps | |
#on VPS: | |
cd /var/repo | |
mkdir [site].git && cd [site].git | |
git init --bare | |
cd hooks | |
cat > post-receive | |
#in post-receive file: | |
#!/bin/sh | |
git --work-tree=/var/www/[domain].com --git-dir=/var/repo/[site].git checkout -f | |
#write, quit | |
chmod +x post-receive | |
#on Local Machine in repo root: | |
git remote add live ssh://root@[domain].com/var/repo/site.git | |
git push live master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment