File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,14 +30,6 @@ $ commit "New feature"
3030git commit -m " New feature"
3131```
3232
33- You can create a file ` .ignore ` in your directory to add custom branches you want to ignore. Example ` .ignore ` file:
34-
35- ```
36- hot-fix
37- sprint-11
38- new-feature
39- ```
40-
4133## License
4234
4335[ MIT] ( LICENSE )
Original file line number Diff line number Diff line change 22
33echo ' Running commit script'
44
5- IGNORED_BRANCHES=(" dev" " master" " qa" " uat" " staging" )
6-
7- IGNORED_PATH=" ./.ignore"
8- if [ -f " $IGNORED_PATH " ]
9- then
10- CUSTOM_BRANCHES=$( cat " $IGNORED_PATH " )
11- BRANCHES=( $CUSTOM_BRANCHES )
12- IGNORED_BRANCHES=( ${IGNORED_BRANCHES[@]} ${BRANCHES[@]} )
13- fi
14-
155CURRENT_BRANCH_CMD=" git rev-parse --abbrev-ref HEAD"
166CURRENT_BRANCH=$( eval $CURRENT_BRANCH_CMD )
177
188COMMIT_WITH_BRANCH=" git commit -m \" $CURRENT_BRANCH : $1 \" "
199DEFAULT_COMMIT=" git commit -m \" $1 \" "
20- IS_IGNORED=false
21-
22- for branch in " ${IGNORED_BRANCHES[@]} " ;
23- do
24- if [ " $CURRENT_BRANCH " == $branch ]
25- then
26- IS_IGNORED=true
27- break
28- fi
29- done
3010
31- if [ " $IS_IGNORED " == false ]
11+ if [ " $CURRENT_BRANCH " != " dev " ] && [ " $CURRENT_BRANCH " != " master " ] && [ " $CURRENT_BRANCH " != " qa " ] && [ " $CURRENT_BRANCH " != " uat " ] && [ " $CURRENT_BRANCH " != " staging " ]
3212then
3313 echo " Commiting with branch name -> $CURRENT_BRANCH "
3414 eval $COMMIT_WITH_BRANCH
You can’t perform that action at this time.
0 commit comments