From 735cc3d23fe2411425474f5ea79192e243523800 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 4 Aug 2021 21:41:47 +0300
Subject: [PATCH] Shell function for starting a new experiment.

---
 .bashrc | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/.bashrc b/.bashrc
index 118729a..9a77094 100644
--- a/.bashrc
+++ b/.bashrc
@@ -203,6 +203,24 @@ match_ssl_pair () {
     return "$exitcode"
 }
 
+new_experiment () {
+    if [ "$#" -ne 1 ]
+    then
+        echo 'Usage: new_experiment EXPERIMENT_NAME' >&2
+        return 1
+    fi
+    local name="$1"
+    local repo="$HOME/Repositories/Shore/experiments"
+    if [ ! -d "$repo/.git" ]
+    then
+        git clone git@git.shore.co.il:nimrod/experiments.git "$repo"
+    fi
+    # shellcheck disable=SC2164
+    cd "$HOME/Repositories/Shore/experiments"
+    git checkout master
+    git checkout -b "$name/master"
+}
+
 # shellcheck disable=SC2120
 prune_ssh_sockets () {
     { [ "${1:-}" != '-f' ] && [ "${1:-}" != '--force' ]; } || killall -v ssh || true
-- 
GitLab