0.0.5 โข Published 8 months ago
git-main v0.0.5
git-main
Switch to main branch, clean up merged branches, and handle dependencies - all in one command
Features
- ๐ Auto-detects and switches to main/master branch
- ๐งน Cleans up fully merged branches
- ๐ฆ Handles dirty working directory gracefully
- ๐ฆ Auto-updates dependencies if lockfile changed
- ๐ฏ Supports yarn, pnpm, and npm
- โก๏ธ Fast and lightweight
Installation
npm install -g git-main
Or use it directly with npx:
npx git-main
Usage
Simply run git-main
in any git repository. The tool will:
- Switch to your main branch (auto-detects main/master)
- Clean up your working directory if needed
- Pull latest changes
- Remove fully merged branches
- Update dependencies if lockfile changed (supports yarn, pnpm, and npm)
Package Manager Support
The tool automatically detects your package manager based on lockfiles:
yarn.lock
โ usesyarn --immutable
pnpm-lock.yaml
โ usespnpm install --frozen-lockfile
package-lock.json
โ usesnpm ci
Example
$ git-main
โน Using main branch: main
โ Fetching latest changes...
โ Pulling latest changes...
โ Cleaning up merged branches...
โน Deleting branch feature/123 (Branch is fully merged)
โน Deleting branch fix/456 (Branch content matches current main)
โ Installing dependencies with pnpm...
โ All done! ๐
License
MIT ยฉ Jan Nicklas