From 14279f63eb660fec8b88fcfcf7a641b3556f5746 Mon Sep 17 00:00:00 2001 From: sthope Date: Mon, 28 Aug 2023 21:02:58 +0200 Subject: [PATCH] Initial commit --- sthope/git_commit | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 sthope/git_commit diff --git a/sthope/git_commit b/sthope/git_commit new file mode 100644 index 0000000..cae5185 --- /dev/null +++ b/sthope/git_commit @@ -0,0 +1,17 @@ +#!/bin/bash + +commit_message="Initial commit" + +# Iterate through the arguments to find the --b flag and a branch name +for ((i=1; i<=$#; i++)); do + if [[ "${!i}" == "--commit_msg" && ! -z "${!((i+1))}" ]]; then + commit_message=="${!((i+1))}" + break + fi +done + +git add . + +git commit -m "$commit_message" + +git push --set-upstream origin main