FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
smart-commit/commit at main · sbimochan/smart-commit · GitHub
sbimochan
/
smart-commit
Public
Notifications
You must be signed in to change notification settings
Fork
12
Star
96
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
smart-commit
/
commit
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
38 lines (32 loc) · 1018 Bytes
Breadcrumbs
smart-commit
/
commit
Copy path
File metadata and controls
executable file
·
38 lines (32 loc) · 1018 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!
/usr/bin/env bash
set
-euo pipefail
if
[
-z
"
${1
:-
}
"
]
||
[
"
$1
"
=
"
-h
"
]
||
[
"
$1
"
=
"
--help
"
]
;
then
echo
-e
"
Create a commit prefixed with the current branch name.\n
"
echo
"
Usage:
"
echo
-e
"
commit MESSAGE\n
"
echo
"
Example:
"
echo
"
commit
\"
Hello world!
\"
"
exit
1
fi
CURRENT_BRANCH=
"
$(
git symbolic-ref --short HEAD
)
"
GIT_ROOT_DIRECTORY=
$(
git rev-parse --show-toplevel
)
IGNORED_BRANCHES=(
"
dev
"
"
master
"
"
main
"
"
qa
"
"
uat
"
"
staging
"
)
CUSTOM_IGNORED_PATH=
"
$GIT_ROOT_DIRECTORY
/.smart-commit-ignore
"
if
[
-f
"
$CUSTOM_IGNORED_PATH
"
]
;
then
CUSTOM_BRANCHES=
$(
cat
"
$CUSTOM_IGNORED_PATH
"
)
BRANCHES=(
$CUSTOM_BRANCHES
)
IGNORED_BRANCHES=(
${IGNORED_BRANCHES[@]}
${BRANCHES[@]}
)
fi
IS_IGNORED=false
for
branch
in
"
${IGNORED_BRANCHES[@]}
"
;
do
if
[
"
$CURRENT_BRANCH
"
==
$branch
]
;
then
IS_IGNORED=true
break
fi
done
if
[
"
$IS_IGNORED
"
==
false
]
;
then
#
Edit your config here
git commit -m
"
$CURRENT_BRANCH
:
$1
"
${
@:
2}
else
git commit -m
"
$1
"
${
@:
2}
fi
Back
|
FazBrowse Home
|
New Git URL