A simple tool to facilitate the commit process through the terminal.
Use the npm command to install this library globally
npm i -g ezcommit
Run the follow command after finish your project updates:
ezcommit
Some options will appear in the terminal so that you can set up your commit.
Whenever you select an option, use the enter
key to confirm, or use the shortcut ctrl + c
to end the flow.
√ add changes? ... no / yes
√ files to add: » .gitignore, package.json
√ type of task (required): » feat
√ scope of task (empty for no use): ... init
√ description of commit (required): ... add some nice resource
√ body of commit (empty for no use, semicolon for break lines, max 3 lines): ... this is a nice resource
√ footer of commit (empty for no use, one line): ... by: lucasrochacc
√ push changes to current branch (feat/do-something)? ... no / yes
Result:
feat(init): add some nice resource
this is a nice resource
by: lucasrochacc
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Fri May 21 15:35:35 2021 -0300
#
# On branch feat/do-something
The first question is whether you want to add the changes made to the project. Choose yes
or no
.
? add changes? no / yes
If you choose no
, you will be redirected to the next step.
Otherwise, you will be directed to a multi-selection menu, which contains all new, modified or deleted files.
You can select / deselect all options using the 'a' key or select / deselect a single option using space or
the ←/→
keys.
? files to add: press a to select/deselect all | space or ←/→ to toggle selection
( ) .gitignore
( ) package.json
After adding the commit files, select the type of task you are working on. If your task is on the list, just select your option, and you will be directed to the next step.
? type of task (required): - Use arrow-keys. Return to submit.
> feat
fix
chore
docs
refactor
style
test
other
Otherwise, choose the option
others
, and you will be taken to the step of filling in the name of the task, just enter the name and continue.
? set the type of task (required):
After selecting the type of task, you will be redirected to the step of filling the scope of the task. This parameter is optional, if you don't want to fill it out, just continue.
? scope of task (empty for no use):
After filling in the scope of the task, you will be redirected to the step of filling out the commit description. This parameter is mandatory, so it is necessary to fill it in before continuing.
? description of commit (required):
After filling in the task description, you will be redirected to the step of filling in the commit body.
You can use semicolons ;
to add break lines, but currently it is restricted to only three lines.
This parameter is optional, if you don't want to fill it out, just continue.
? body of commit (empty for no use, semicolon for break lines, max 3 lines):
After filling in the commit body, you will be redirected to the step of filling out the commit footer. Currently, the footer can only contain one line. This parameter is optional, if you don't want to fill it out, just continue.
? footer of commit (empty for no use, one line):
Finally, after filling in the option at the bottom of the commit, you will be redirected to the step of doing git push to your current branch.
? push changes to current branch (feat/do-something)? no / yes
Select yes to push, or select no, if you do not want to push or if you want to push to another branch. If you choose to commit only, a message will appear confirming that the commit was successful.
Commit successfully. To check, just use the command "git log -i" in terminal.
You can check the final commit message using the git log -i
command.
If you choose to push, a message will appear confirming that the push was made in the current repository.
-
You can only use the features if you are in a git project (which contains the .git folder).
-
You can only use the features if your git project is pointing to a remote url.
-
You can cancel the process during execution by pressing CTRL + C. In this case, no action will be taken.
-
If you have not chosen the push option, and you made a mistake when writing the commit message, use the
git commit --amend
command to edit your commit before giving the push. -
If you chose the push option, and made a mistake when writing the c ommit message, use the command
git revert <commit_hash>
to go back.
-
Inspired in Conventionall Commits.
-
More details in the wiki page as soon as possible.
- ¹A detailed wiki for library usage
- ²Allow more lines in body and footer.
Distributed under the Apache License 2.0. See LICENSE
for more information.