README
ΒΆ
πΏ GitSync - Smart Branch Manager
A beautiful, interactive TUI (Terminal User Interface) tool for managing multiple git branches with ease. It transforms the tedious task of updating multiple branches into a visual, enjoyable experience.
The Problem It Solves
When working with multiple feature branches, you often need to:
- Keep them all up-to-date with the main branch
- Rebase them regularly to avoid conflicts
- Remember what each branch is for
- See which branches are behind
Doing this manually for each branch is tedious and error-prone. GitSync provides a visual and interactive solution to streamline this workflow.
β¨ Core Features
π Smart Auto-Detection
- Base Branch Detection - Automatically finds your main branch (main, master, dev-integration, develop).
- Remote Detection - Discovers upstream and origin remotes without configuration.
- Branch Discovery - Scans and lists all local branches (excluding the base branch).
- Zero Config - Works out of the box for standard git workflows.
π Rich Branch Information
- Ahead/Behind Counts - Shows how many commits each branch is ahead or behind the base.
- Last Commit Time - Displays when each branch was last updated (e.g., "2 days ago").
- Status Indicators - Visual dots showing branch state:
- π’ Green: Up to date with base.
- π‘ Yellow: Behind base branch.
- π΄ Red: Has conflicts.
- Custom Descriptions - Add notes to remember what each branch is for.
π― Interactive Selection
- Keyboard Navigation - Use arrow keys (β/β) or vim-style (j/k).
- Toggle Selection - Use the spacebar to select/deselect individual branches.
- Bulk Operations:
- Press
ato select all branches. - Press
nto deselect all branches.
- Press
- Visual Feedback - Selected branches show checkboxes (β).
π Branch Tagging System
- Add Descriptions - Press
tto tag any branch with a description. - Persistent Storage - Tags are stored in your local git config and persist across sessions.
- Easy Editing - A simple text input interface for adding and editing tags.
π Smart Update Process
- Fetch Upstream - Downloads the latest changes from your upstream remote.
- Update Base Branch - Resets your local base branch to match upstream.
- Rebase Branches - Rebases each selected branch onto the updated base.
- Push to Origin - Force-pushes (with lease) the rebased branches to your origin.
- Conflict Handling - Gracefully skips branches with conflicts and reports them at the end.
π¨ Beautiful & Informative UI
- Color-Coded Interface for quick status recognition.
- Real-Time Updates with a live progress bar during operations.
- Detailed Summary Report showing successful and failed operations.
π‘οΈ Safe Operations
- Force-with-Lease - Uses
--force-with-leasefor safer force pushing. - Conflict Detection - Detects and skips conflicting branches, never leaving the repository in a broken state.
- Uncommitted Changes Check - Warns you if you have uncommitted work before starting.
π Installation
Using go install
You can install gitsync with a single command. Replace user/repo with the actual repository path.
go install github.com/user/repo@latest
From Source
Alternatively, you can build from source.
-
Clone the repository:
git clone <repository_url> cd gitsync -
Build the binary:
make build -
Install it globally:
make install
π Getting Started: 5-Minute Tutorial
-
Navigate to your git repository:
cd /path/to/your/repo -
Run GitSync:
gitsyncYou'll see a list of all your local branches.
-
Browse and Select:
- Use the arrow keys (
β/β) to navigate. - Press the spacebar to select one or more branches.
- Press
ato select all branches.
- Use the arrow keys (
-
Tag a Branch (Optional):
- Navigate to a branch and press
t. - Type a description (e.g., "Feature: new payment gateway") and press
Enter. This helps you remember the purpose of the branch.
- Navigate to a branch and press
-
Update:
- Press
Enterto start the update process. - GitSync will fetch, update your base branch, and rebase all selected branches.
- Press
-
Review the Summary:
- After the process completes, a summary will show which branches were updated successfully and which failed (e.g., due to conflicts).
β¨οΈ Keyboard Shortcuts
| Key | Action |
|---|---|
β / β |
Navigate up/down |
j / k |
Navigate (vim-style) |
space |
Toggle selection |
a |
Select all branches |
n |
Deselect all branches |
t |
Tag/describe branch |
enter |
Start update process |
y |
Confirm (in manual mode) |
n |
Cancel (in manual mode) |
esc |
Cancel tagging |
q |
Quit application |
ctrl+c |
Force quit |
βοΈ Configuration (Optional)
For most standard workflows, no configuration is needed. However, you can customize GitSync's behavior by creating a .gitsync.yaml file in your repository's root directory.
# .gitsync.yaml
# Override the auto-detected base branch
base_branch: dev-integration
# Specify non-standard remote names
upstream_remote: upstream
origin_remote: fork
# Configure patterns to exclude certain branches from the list
exclude_patterns:
- "release/"
- "hotfix/"
- "archive/"
ποΈ Manual Mode
If you prefer more control or want to see what commands are being run, use the manual mode flag:
gitsync -m
# or
gitsync --manual
In manual mode, GitSync will show you exactly what will happen and ask for your confirmation before starting the update process.
π οΈ For Developers: Technical Details
Project Structure
gitsync/
βββ .github/
β βββ workflows/
β βββ release.yml # Github action for release
βββ main.go # Entry point, CLI flags
βββ git.go # Git operations (fetch, rebase, push, etc.)
βββ ui.go # Bubbletea UI (model, update, view)
βββ config.go # Configuration loading/saving
βββ tags.go # Branch tagging system
βββ scripts/ # Shell scripts for build and install
β βββ build.sh # Cross-platform build script
β βββ install.sh # Installation script
βββ go.mod # Go module definition
βββ go.sum # Dependency checksums
βββ Makefile # Build automation
βββ README.md # This file
βββ .goreleaser.yml # GoReleaser configuration
βββ .gitignore
βββ .gitsync.yaml.example
βββ LICENSE
Dependencies
- Bubbletea: TUI framework
- Lipgloss: Terminal styling
- YAML v3: Configuration parsing
Building from Source
- Build for your platform:
./scripts/build.sh - Run tests or other commands:
make build # Build the binary make install # Install it globally make clean # Clean build artifacts - Cross-platform builds:
The
scripts/build.shscript is configured to build for multiple platforms (macOS, Linux, Windows)../scripts/build.sh all
License
This project is licensed under the MIT License.
Documentation
ΒΆ
There is no documentation for this package.