Package Exports
- git-auto-rebase-cli
- git-auto-rebase-cli/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (git-auto-rebase-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
git-auto-rebase-cli
A CLI tool that provides git automation commands including auto-rebase and amend-push functionality.
Installation
npm install -g git-auto-rebase-cli
Usage
In any git repository directory, run:
Auto Rebase (default)
git-auto-rebase
# or explicitly
git-auto-rebase rebase
Amend and Push
git-auto-rebase amend
# or
git-auto-rebase amend-push
Help
git-auto-rebase --help
# or
git-auto-rebase -h
What it does
Auto Rebase Command (rebase
)
- Checks if you're in a git repository
- Verifies working directory is clean (no uncommitted changes)
- Gets current branch name
- Switches to main branch
- Pulls latest changes from origin/main
- Switches back to your original branch
- Rebases your branch onto main
- Pushes changes with
--force-with-lease
Amend and Push Command (amend
)
- Checks if you're in a git repository
- Gets current branch name
- Prevents execution on main branch for safety
- Amends the last commit without editing the message (
git commit --amend --no-edit
) - Pushes changes with
--force-with-lease
Help Command (--help
)
Displays usage information including:
- Available commands and their descriptions
- Usage examples
- Safety features overview
Requirements
- Node.js >= 12.0.0
- Git repository
- Clean working directory (no uncommitted changes)
Safety Features
- Checks for uncommitted changes before proceeding (rebase command)
- Uses
--force-with-lease
for safer force pushes - Prevents amend-push on main branch for safety
- Error handling with clear messages
- Exits gracefully if not in a git repository
Example Output
Auto Rebase
Starting git auto rebase...
Current branch: feature-branch
Checking if working directory is clean...
Switching to main branch...
Pulling latest changes from main...
Switching back to feature-branch branch...
Rebasing feature-branch onto main...
Pushing changes with force-with-lease...
Git auto rebase completed successfully!
Amend and Push
Starting git amend and push...
Current branch: feature-branch
Amending last commit without editing message...
Pushing changes with force-with-lease...
Git amend and push completed successfully!
Help Output
git-auto-rebase-cli v1.1.1
Usage:
git-auto-rebase [command]
Commands:
rebase Automatically rebase current branch onto main (default)
amend Amend last commit and force push with --force-with-lease
amend-push Same as amend
--help, -h Show this help message
Examples:
git-auto-rebase # Run auto rebase (default)
git-auto-rebase rebase # Run auto rebase explicitly
git-auto-rebase amend # Amend last commit and push
git-auto-rebase --help # Show this help
License
MIT