Commit 26fb51b 1 parent a609cd3 commit 26fb51b Copy full SHA for 26fb51b
File tree 5 files changed +34
-3
lines changed
5 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,9 @@ 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
+ | ` gc ` | ` git commit -m ${commitMessage} ` | Commit the staged files with the give message |
38
38
| ` gcpm ` | ` gcm && gpm ` | Checkout master and pull |
39
+ | ` gca ` | ` git commit -am ${commitMessage} ` | Commit all the files with the give message |
39
40
40
41
### Master branch name is configurable:
41
42
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env node
2
+ import main from "../lib/git_add_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
+ runCommand ( `git add . && git commit -m "${ commitMessage } "` ) ;
25
+ } ;
26
+
27
+ export default main ;
Original file line number Diff line number Diff line change @@ -21,8 +21,6 @@ const main = async () => {
21
21
commitMessage = await getCommitMessage ( ) ;
22
22
}
23
23
24
- console . log ( commitMessage ) ;
25
-
26
24
runCommand ( `git commit -m "${ commitMessage } "` ) ;
27
25
} ;
28
26
Original file line number Diff line number Diff line change 22
22
"grb" : " bin/git_reset_current_branch.js" ,
23
23
"gphf" : " bin/git_push_head_force.js" ,
24
24
"gc" : " bin/git_commit_message.js" ,
25
+ "gca" : " bin/git_add_commit_message.js" ,
25
26
"gcpm" : " bin/git_checkout_pull_master.js"
26
27
},
27
28
"author" : " Kavinkumar R" ,
You can’t perform that action at this time.
0 commit comments