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,6 +30,14 @@ $ 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+
3341## License
3442
3543[ 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+
515CURRENT_BRANCH_CMD=" git rev-parse --abbrev-ref HEAD"
616CURRENT_BRANCH=$( eval $CURRENT_BRANCH_CMD )
717
818COMMIT_WITH_BRANCH=" git commit -m \" $CURRENT_BRANCH : $1 \" "
919DEFAULT_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
1030
11- if [ " $CURRENT_BRANCH " != " dev " ] && [ " $CURRENT_BRANCH " != " master " ] && [ " $CURRENT_BRANCH " != " qa " ] && [ " $CURRENT_BRANCH " != " uat " ] && [ " $CURRENT_BRANCH " != " staging " ]
31+ if [ " $IS_IGNORED " == false ]
1232then
1333 echo " Commiting with branch name -> $CURRENT_BRANCH "
1434 eval $COMMIT_WITH_BRANCH
You can’t perform that action at this time.
0 commit comments