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
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
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!
License
MIT