commit 6d2469e0a3725c1050b12fe5cc782da2ca73db2a
parent f28687126082af47ac2c22cb45dde60f8150c7fc
Author: pyratebeard <root@pyratebeard.net>
Date: Tue, 18 Oct 2022 21:52:28 +0100
Merge branch 'make' into smoke_me_a_kipper
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/draft b/scripts/draft
@@ -6,8 +6,8 @@ POST="entry/${TITLE}.md"
# checkout the correct branch
git branch | grep ${TITLE} && \
- git checkout ${TITLE} || \
- git checkout -b ${TITLE}
+ git checkout -q ${TITLE} || \
+ $(git checkout -q main && git checkout -q -b ${TITLE}) || exit 1
# if post file does not exist yet touch it
[ -f "${POST}" ] || touch "${POST}"
@@ -16,5 +16,7 @@ git branch | grep ${TITLE} && \
vim "${POST}"
# when vim closes add and commit the changes
+# if there are any
+git status | grep "${POST}" || exit 0
git add "${POST}"
git commit -S -m "${TITLE}"