Last active
August 29, 2015 14:13
-
-
Save RickyCook/c0ea491eac1fd65b4b09 to your computer and use it in GitHub Desktop.
Rsync a git repo to its remote. For when you want to sync, but not commit
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
#!/bin/bash | |
remote_name="$1" | |
: ${remote_name:="origin"} | |
git_root="$(cd "$(git rev-parse --show-toplevel)"; pwd)/" | |
rsync_dest=$(git remote -v | grep "^$remote_name\s.*\(push\)" | awk '{print $2}') | |
echo "Remote name: $remote_name" | |
echo "Repo root: $git_root" | |
echo "Repo dest: $rsync_dest" | |
rsync -zr --progress --exclude .git "$git_root" "$rsync_dest" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment