summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2007-06-19 19:48:56 +0200
committerJens Axboe <jens.axboe@oracle.com>2007-06-19 19:48:56 +0200
commit1da31518ee54d8b373b659047d01013371228c39 (patch)
tree59c08d302a4c65da4c38ca6867ce6c16cc146de5
parent231077a9356a95f89a12799afac9f1f730081597 (diff)
downloadag-1da31518ee54d8b373b659047d01013371228c39.tar.gz
ag-1da31518ee54d8b373b659047d01013371228c39.tar.bz2
ag-branch-cp: local branch copy
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rwxr-xr-xag-branch-cp25
1 files changed, 25 insertions, 0 deletions
diff --git a/ag-branch-cp b/ag-branch-cp
new file mode 100755
index 0000000..5ef266a
--- /dev/null
+++ b/ag-branch-cp
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+if [ ! -d .git ]; then
+ echo Does not appear to be a git tree
+ exit 1
+fi
+
+if [ "$1"x == x ]; then
+ echo Need source branch as first argument
+ exit 1
+fi
+SRC=$1
+
+if [ "$2"x == x ]; then
+ echo Need destination branch as second
+ exit 1
+fi
+DST=$2
+
+if [ ! -f .git/refs/heads/$SRC ]; then
+ echo Source branch $SRC does not exist
+ exit 2
+fi
+
+cp .git/refs/heads/$SRC .git/refs/heads/