From 64758003e47da2ddc1f7e02f368cdaab744718a9 Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Wed, 13 Apr 2022 13:14:28 +0200 Subject: [PATCH] Add script to simplify adding new scripts --- add-new.zsh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 add-new.zsh diff --git a/add-new.zsh b/add-new.zsh new file mode 100755 index 0000000..6118a06 --- /dev/null +++ b/add-new.zsh @@ -0,0 +1,16 @@ +#!/bin/zsh +if git status --porcelain | grep -q '^A'; then + echo 'You have uncommited but staged changes. Aborting' + exit 1 +fi +if [[ ! -e $1 ]]; then + echo "$1 not found" + exit 1 +fi +if ! git status --porcelain -- $1 | grep -q '^\?\?'; then + echo "$1 already in repository" + exit 1 +fi + +git add $1 +git commit -m "New script: $1"