From 58ed624130253579365967fdc968bfc1d37279fb Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 18 Sep 2014 16:36:24 -0300 Subject: Initial import --- git-subtree-push | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 git-subtree-push (limited to 'git-subtree-push') diff --git a/git-subtree-push b/git-subtree-push new file mode 100755 index 0000000..41ffe25 --- /dev/null +++ b/git-subtree-push @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Push changes in a subtree to a remote. +# + +# Parameters +BASENAME="`basename $0`" +REMOTE="$1" +FOLDER="$2" + +# Syntax +if [ -z "$2" ]; then + echo "usage: $BASENAME " + exit 1 +fi + +# Check remote +if ! git remote | grep -qe "^$REMOTE"; then + echo "fatal: no such remote $REMOTE" + exit +fi + +# Fetch the remote +git fetch $REMOTE master + +# Process +if [ ! -d "$FOLDER" ]; then + echo "fatal: folder $FOLDER does not exist" + exit 1 +else + # Update a subtree + git subtree push --prefix=$FOLDER $REMOTE master +fi -- cgit v1.2.3