git-push-helper
v1.0.3
Published
A helper tool to simplify git commit and push commands
Readme
git-push-helper
A simple and efficient command-line tool to simplify Git commit and push workflows.
Installation
Install Globally
To install git-push-helper globally, use:
npm install -g git-push-helperUsage
After installing, you can use the push command globally to commit and push your changes in a single step.
push "<commit-message>" [branch-name] [-p] [-m]Parameters
<commit-message>: The commit message to use.[branch-name]: (Optional) The branch to push to. If not provided, the script will detect the current branch automatically. If the specified branch does not exist, it will be created and switched to.-p: (Optional) Increment the patch version inpackage.jsonandpackage-lock.jsonbefore committing (e.g.,1.0.1→1.0.2).-m: (Optional) Increment the minor version inpackage.jsonandpackage-lock.jsonbefore committing (e.g.,1.1.0→1.2.0).
Example:
Push without version bump:
push "Fix login bug"This will:
- Commit your changes with the message "Fix login bug".
- Push the changes to the detected branch.
Push with patch version bump:
push "Add new feature" -pThis will:
- Increment the patch version (e.g.,
1.0.1→1.0.2). - Commit the version bump.
- Commit your changes with the message "Add new feature".
- Push the changes to the detected branch.
- Increment the patch version (e.g.,
Push with minor version bump:
push "Add major feature" -mThis will:
- Increment the minor version (e.g.,
1.1.0→1.2.0). - Commit the version bump.
- Commit your changes with the message "Add major feature".
- Push the changes to the detected branch.
- Increment the minor version (e.g.,
Specify a branch (branch exists):
push "Update styles" devThis will:
- Commit your changes with the message "Update styles".
- Push the changes to the
devbranch.
Specify a branch (branch does not exist):
push "Enhance API" new-featureThis will:
- Create the
new-featurebranch if it doesn't exist. - Switch to the
new-featurebranch. - Commit your changes with the message "Enhance API".
- Push the changes to the
new-featurebranch.
- Create the
Branch Handling
- If the specified branch does not exist, the script will create it and switch to it.
- If the branch already exists, the script will switch to it without attempting to recreate it.
Error Handling
If any error occurs during the Git operations, the tool will provide an error message and exit.
Features
- Automates the
git add,git commit, andgit pushworkflow. - Auto-detects the current branch if no branch is specified.
- Creates and switches to a new branch if the specified branch does not exist.
- Supports optional version bumping:
-p: Increment patch version (e.g.,1.0.1→1.0.2).-m: Increment minor version (e.g.,1.1.0→1.2.0).
- Simple and intuitive CLI for quick usage.
- Supports global installation for seamless access from anywhere.
GitHub Repository
Find the source code and contribute to the project on GitHub: git-push-helper
License
This project is licensed under the MIT License.
Made with ❤️ by Tarek El Barody
