npm-git-helper
v2.1.0
Published
A CLI tool to automate common Git operations like staging, committing, and pushing changes
Maintainers
Readme
npm-git-helper
Git Automation CLI Tool
npm-git-helper is a command-line tool designed to automate common Git operations such as adding files, committing changes, and pushing to a GitHub repository with minimal input. This tool simplifies your workflow, allowing you to focus more on development and less on repetitive version control commands.
Features
- Automatic Save & Add: Stages all changes in your repository automatically.
- Customizable Commit Messages: Allows the use of predefined or custom commit messages.
- Automatic Push to GitHub: Pushes commits directly to the remote repository without additional commands.
- Smart Branch Handling: Automatically creates branches if they don't exist and sets upstream tracking.
- Validation Checks: Ensures you're in a git repository and have changes before committing.
- Streamlined Workflow: Run a single command to automate your Git process from start to finish.
Installation
You can install the CLI globally using npm:
npm install -g npm-git-helperUsage
Once installed, the CLI is available as git-helper. Here's how to use it:
Basic Workflow
- Navigate to your local Git repository.
- Run the CLI command to automatically stage, commit, and push changes:
git-helper push -m "Your commit message" -b your-branchExample:
git-helper push -m "Initial commit" -b mainThe tool will:
- Check if you're in a git repository
- Switch to the specified branch (or create it if it doesn't exist)
- Stage all changes (
git add .) - Commit the changes with the provided message (
git commit -m "your message") - Push the changes to the specified branch on GitHub with upstream tracking (
git push -u origin your-branch)
Additional Commands
Check the version:
git-helper --versionGet help:
git-helper --helpRequirements
- Node.js >= 14.0.0
- Git installed and configured
- An initialized git repository
How It Works
- Validation: Checks if you're in a valid git repository
- Branch Management: Switches to or creates the target branch before making changes
- Change Detection: Verifies there are changes to commit
- Staging: Stages all modified and new files
- Committing: Creates a commit with your message
- Pushing: Pushes to remote with automatic upstream tracking
Prospective Updates
- Interactive Mode: Prompt users for commit messages and changes to be staged
- Configuration File Support: Add support for
.git-helper-config.jsonfor default settings - Selective Staging: Choose specific files to stage instead of staging all changes
- Multi-Branch Support: Push to multiple branches or trigger pull requests
- Pre-Push Hooks: Run pre-push scripts such as linting or testing
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests on GitHub.
License
This project is licensed under the ISC License - see the LICENSE.md file for details.
Author
Leslie Paul Ajayi
