File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- ## Smart commit
2- Create commit with current branch name
1+ # Smart Commit
32
4- For example:
5- If your current branch name is ``` EF-803 ```
3+ Create a commit prefixed with the current branch name.
64
7- ``` commit "New feature" ```
5+ ## Installation
86
9- will produce command
7+ Run this command on terminal.
108
11- ``` git commit -m "EF-803: New feature" ``` and execute it
9+ ``` shell
10+ curl https://raw.githubusercontent.com/sbimochan/smart-commit/master/commit -o /usr/local/bin/commit && chmod +x /usr/local/bin/commit
11+ ```
1212
13- If your current branch is ``` dev or uat or qa or master ```
13+ ## Usage
1414
15- ``` commit "New feature" `` `
15+ * If your current branch name is ` EF-803 `
1616
17- will produce default command
17+ ``` shell
18+ $ commit " New feature"
1819
19- ``` git commit -m "New feature" ``` and execute it
20+ # translates to
21+ git commit -m " EF-803: New feature"
22+ ```
2023
21- ### Installation
22- Run this command on terminal
24+ * If your current branch is either of ` dev ` , ` uat ` , ` qa ` , ` staging ` or ` master `
2325
24- ``` curl https://raw.githubusercontent.com/sbimochan/smart-commit/master/commit -o /usr/local/bin/commit && chmod +x /usr/local/bin/commit ```
26+ ``` shell
27+ $ commit " New feature"
2528
26- And restart the terminal
29+ # translates to
30+ git commit -m " New feature"
31+ ```
32+
33+ ## License
34+
35+ [ MIT] ( LICENSE )
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
2+
23echo ' Running commit script'
4+
35CURRENT_BRANCH_CMD=" git rev-parse --abbrev-ref HEAD"
46CURRENT_BRANCH=$( eval $CURRENT_BRANCH_CMD )
57
@@ -8,7 +10,7 @@ DEFAULT_COMMIT="git commit -m \"$1\""
810
911if [ " $CURRENT_BRANCH " != " dev" ] && [ " $CURRENT_BRANCH " != " master" ] && [ " $CURRENT_BRANCH " != " qa" ] && [ " $CURRENT_BRANCH " != " uat" ] && [ " $CURRENT_BRANCH " != " staging" ]
1012then
11- echo " Commiting with branch name-> $CURRENT_BRANCH "
13+ echo " Commiting with branch name -> $CURRENT_BRANCH "
1214 eval $COMMIT_WITH_BRANCH
1315else
1416 echo " Commiting with default branch"
You can’t perform that action at this time.
0 commit comments