Created
November 22, 2013 16:09
-
-
Save aroberts/7602376 to your computer and use it in GitHub Desktop.
Git command for moving dirty changes from machine to machine. Takes remote host as the first argument, and remote path as optional second argument (defaults to inferring from current path).
This file contains 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 | |
port=22 | |
while getopts "p:" opt; do | |
case "$opt" in | |
\?) | |
echo "bad opt" | |
exit 1 | |
;; | |
p) port=$OPTARG | |
;; | |
esac | |
done | |
shift $((OPTIND-1)) | |
[ "$1" = "--" ] && shift | |
host=$1 | |
dir=${2:-`echo $PWD | sed "s#^$HOME/##g"`} | |
ssh -p$port $host "cd \"$dir\" && git diff --no-prefix" | patch -p0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment