Skip to content

Commit a91c163

Browse files
authored
Merge pull request #12 from sbimochan/enhancement
Enhancing... Color echo and code cleanups
2 parents 1f57ad0 + 3098780 commit a91c163

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

commit

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

3-
echo 'Running commit script'
4-
4+
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
55
GIT_ROOT_DIRECTORY=$(git rev-parse --show-toplevel)
66
IGNORED_BRANCHES=("dev" "master" "qa" "uat" "staging")
77
CUSTOM_IGNORED_PATH="$GIT_ROOT_DIRECTORY/.smart-commit-ignore"
@@ -13,12 +13,6 @@ then
1313
IGNORED_BRANCHES=(${IGNORED_BRANCHES[@]} ${BRANCHES[@]})
1414
fi
1515

16-
CURRENT_BRANCH_CMD="git rev-parse --abbrev-ref HEAD"
17-
CURRENT_BRANCH=$(eval $CURRENT_BRANCH_CMD)
18-
19-
COMMIT_WITH_BRANCH="git commit -m \"$CURRENT_BRANCH: $1\""
20-
DEFAULT_COMMIT="git commit -m \"$1\""
21-
2216
IS_IGNORED=false
2317

2418
for branch in "${IGNORED_BRANCHES[@]}";
@@ -30,10 +24,11 @@ for branch in "${IGNORED_BRANCHES[@]}";
3024
fi
3125
done
3226

27+
3328
if [ "$IS_IGNORED" == false ]
3429
then
35-
echo "Commiting with branch name -> $CURRENT_BRANCH"
36-
eval $COMMIT_WITH_BRANCH
30+
# Edit your config here
31+
git commit -m "$CURRENT_BRANCH: $1"
3732
else
38-
eval $DEFAULT_COMMIT
33+
git commit -m "$1"
3934
fi

0 commit comments

Comments
 (0)