summaryrefslogtreecommitdiff
path: root/workon
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2018-06-13 21:36:56 -0700
committerBen Sima <ben@bsima.me>2018-06-13 21:36:56 -0700
commit77c9a177b2b595d4ce25095b58e2388fe33cc97a (patch)
tree0853d5c92d67538760005b9c4635a90115bd7ba4 /workon
init
Diffstat (limited to 'workon')
-rwxr-xr-xworkon34
1 files changed, 34 insertions, 0 deletions
diff --git a/workon b/workon
new file mode 100755
index 0000000..42efb77
--- /dev/null
+++ b/workon
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+#
+# workon :: clones a git repo to ~/desk/<repo-name> and sets the remotes
+# appropriately
+#
+# Original author: https://github.com/sumitsu
+
+GITHUB_USER=bsima
+GITHUB_WORK=LiaisonTechnologies
+DESK="${HOME}/desk" # or wherever you typically put your code
+
+for REPO in "$@"
+do
+ echo "${REPO}";
+ if [ ! -d "${DESK}/${REPO}" ]
+ then
+ if ( ! git clone git@github.com:${GITHUB_USER}/${REPO}.git ${DESK}/${REPO} )
+ then
+ echo "FAILED";
+ exit 1;
+ fi;
+ else
+ echo "(already exists)";
+ exit 1;
+ fi;
+ cd "${DESK}/${REPO}";
+ git remote add upstream git@github.com:${GITHUB_WORK}/${REPO}.git;
+ git config branch.master.remote upstream
+ git config branch.master.merge refs/heads/master
+ git config remote.pushDefault origin
+ git remote -v;
+done;
+
+exit 0;