0.0.5 โ€ข Published 8 months ago

git-main v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

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:

  1. Switch to your main branch (auto-detects main/master)
  2. Clean up your working directory if needed
  3. Pull latest changes
  4. Remove fully merged branches
  5. 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 โ†’ uses yarn --immutable
  • pnpm-lock.yaml โ†’ uses pnpm install --frozen-lockfile
  • package-lock.json โ†’ uses npm 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

0.0.5

8 months ago

0.0.4

8 months ago

0.0.2

8 months ago

0.0.1

8 months ago