File tree 4 files changed +36
-1
lines changed
4 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ npm i -g @xniva/git-shortcuts
34
34
| ` gma ` | ` git merge --abort ` | Abort the merge |
35
35
| ` grb ` | ` git reset --${hardOrSoft} origin/$(git rev-parse --abbrev-ref HEAD) ` | Reset the current branch to its remote equivalent |
36
36
| ` gphf ` | ` git push origin HEAD --force ` | Force push the current branch |
37
+ | ` gc ` | ` git commit -m ${commitMessage} ` | Commit with the give message |
37
38
38
39
### Master branch name is configurable:
39
40
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env node
2
+ import main from "../lib/git_commit_message/index.js" ;
3
+
4
+ main ( ) ;
Original file line number Diff line number Diff line change
1
+ import runCommand from "../utils/run_command.js" ;
2
+ import inquirer from "inquirer" ;
3
+
4
+ const getCommitMessage = async ( ) => {
5
+ const inputFields = [
6
+ {
7
+ type : "input" ,
8
+ name : "message" ,
9
+ message : "Enter the commit message: " ,
10
+ } ,
11
+ ] ;
12
+
13
+ const { message } = await inquirer . prompt ( inputFields ) ;
14
+ return message ;
15
+ } ;
16
+
17
+ const main = async ( ) => {
18
+ let commitMessage = process . argv . slice ( 2 ) . join ( " " ) ;
19
+
20
+ if ( ! commitMessage ) {
21
+ commitMessage = await getCommitMessage ( ) ;
22
+ }
23
+
24
+ console . log ( commitMessage ) ;
25
+
26
+ runCommand ( `git commit -m "${ commitMessage } "` ) ;
27
+ } ;
28
+
29
+ export default main ;
Original file line number Diff line number Diff line change 20
20
"gsf" : " bin/git_see_feature_files.js" ,
21
21
"gma" : " bin/git_merge_abort.js" ,
22
22
"grb" : " bin/git_reset_current_branch.js" ,
23
- "gphf" : " bin/git_push_head_force.js"
23
+ "gphf" : " bin/git_push_head_force.js" ,
24
+ "gc" : " bin/git_commit_message.js"
24
25
},
25
26
"author" : " Kavinkumar R" ,
26
27
"license" : " MIT" ,
You can’t perform that action at this time.
0 commit comments