🛠️ syncgit — Git Sync CLI
A lightweight Rust-based CLI to streamline everyday Git flows: detect the repo root, show a clear status, stage only what you need, commit, and push — with a clean, user-friendly terminal UI.
📋 Features
- 🔍 Auto-detects the repository root (
.git
). - 🧭 Shows a minimal header:
Repository root
andSubpath
(relative path from the repo root). - ✅ Global short status (
git status -sb
). - 📄 Subpath-only view grouped by folder (pretty-printed
--porcelain
limited to the current subpath). - ➕ Stages changes only within the current subpath.
- ⏸️ Pause to review: “Press Enter to commit changes…” before asking the commit message.
- ✏️ Commit message prompt, then push.
- ⚠️ Pending pushes detection to avoid duplicate histories.
- 🌐 Offline-friendly: commits locally, defers push with a clear message.
- 🔐 Optional GitHub token (
GITHUB_TOKEN
) to push to private repos via HTTPS. - 🧭 Works from repo root or any subfolder. If not in a repo, lists child repos.
All path-sensitive git
operations use git -C <repo_root>
for robust behavior regardless of where you run syncgit
.
🧱 Requirements
- Rust
- Git installed and configured.
- (Optional) Set a GitHub token as an environment variable for private repositories:
export GITHUB_TOKEN=your_token_here
🚀 Installation
Install Rust if you don’t have it yet:
|
Then install the CLI globally:
🧪 Usage
Run the tool from anywhere inside a Git repository:
Typical flow
- Info header:
Repository root
andSubpath
. - Global short status.
- Check pending pushes; optionally push first.
- Pull changes.
- Local changes check; show subpath-only grouped status.
- Stage only current subpath (idempotent if already staged).
- Pause: press Enter → ask for commit message.
- Commit and push.
Subpath grouping (visual aid)
When you’re in a parent folder with multiple projects, the subpath status is grouped by top-level folder. This keeps large changes readable and helps you focus on a particular folder’s changes when committing from the parent.
🌐 Offline Mode
If no internet connection is detected, changes are committed locally but not pushed. A message will inform you to push manually once online.
🔐 GitHub Token Authentication
To push to private GitHub repositories via HTTPS, the tool will use the GITHUB_TOKEN
environment variable (if available) to authenticate securely by rewriting the remote URL temporarily.
📦 Update to latest version
- Update this CLI:
- Or manage binaries with cargo-update:
📎 Dependencies
term_size
: For responsive terminal layout.- Standard Rust
std::process
,std::io
,std::env
, andstd::net
.
📝 Changelog
- 0.1.6
- Grouped subpath status printing for cleaner views in parent folders with many projects.
- Staging limited to current subpath; consistent
git -C <root>
usage. - “Press Enter to commit changes…” pause before commit message.
- Header simplified:
Repository root
+Subpath
. - Various UX improvements and clearer outputs.
🤝 Contributions
Pull requests and feedback are welcome! Please open an issue first to discuss any major changes.
Made with ❤️ in Rust.