Context-aware git CLI for multi-project research repos with worktree, squash, and fzf support.
Project description
🧠 git-ctx (git with -k for context)
A context-aware Git CLI wrapper for multi-project repositories. Use
git -k ...to activate!
💡 Why git -k?
In large research or dev repos, you often juggle multiple projects and subprojects. That makes your Git workflow chaotic:
- Unstructured branch names
- No clarity which branch belongs to which subproject
- Tedious checkouts and pushes
git-ctx introduces a context system using a project.context file. It wraps normal Git commands to:
- ✅ Automatically prefix branch names with project/subproject
- 🔍 Let you fuzzy-pick branches with
fzf - 🌳 Work smoothly inside worktrees
- 💥 Bypass with regular Git anytime
🚀 How It Works
You just add -k (or --ctx) to any git command to enable the context mode:
git -k checkout mybranch # Resolves to: project/subproject/mybranch
git -k push # Pushes current context-prefixed branch
git -k branch # Lists branches in current context
To fallback to normal git:
git status # Regular Git
git -k status # Also regular Git (noop)
📂 Setup
🔁 Install in Dev Mode
git clone https://github.com/your-user/gitctx.git
cd gitctx
python -m venv venv
source venv/bin/activate
pip install -e ".[dev]"
Then, alias your local script as git:
alias git='python /path/to/git_ctx_k.py'
Or install globally with an entry point ([project.scripts]) in pyproject.toml.
📄 project.context Format
At the root of your repo, define the context:
[context]
project = vision
subproject = segmentation
If no subproject:
[context]
project = vision
Your branch names will automatically be prefixed:
vision/mainvision/segmentation/feature-x
⚙️ Supported Commands
git -k checkout feature/xyz # Checkout branch in context
git -k checkout --pick # Fuzzy pick
git -k create new-feature # Create context branch
git -k push --force-with-lease # Push current branch
git -k branch # List context branches
git -k fetch # Fetch remote branches under context
🔍 Requirements
- Python 3.8+
fzf(for interactive mode)
🔬 Testing
pytest tests/
🧪 Future Features
- Commit squashing with autosquash
-
git -k squashflow - GitHub PR integration
-
git -k worktree add - Cross-context dashboard
📜 License
MIT © AxOr
⭐️ Contribute
If you find this useful:
- Star the repo ⭐️
- Share it
- File issues and ideas 🧠
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitcontext-0.2.0.tar.gz.
File metadata
- Download URL: gitcontext-0.2.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc12b92a2753277ac33fccf939423dd0f0ba907afb2f59ed695a7daef3f5fb1a
|
|
| MD5 |
71292fe770c58badc89d8ab1171d1358
|
|
| BLAKE2b-256 |
d0dafa378b02f8a08191fa9c81a8fae320b31ce5be10abeac28dad95197d5290
|
File details
Details for the file gitcontext-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gitcontext-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b79474463457629dc8d9a5745b1d2d1dadc326a64d24ee183c1d02e6869cf17c
|
|
| MD5 |
b4f709ea209b805899437fde149cd459
|
|
| BLAKE2b-256 |
50a772876557bc17178fae9cabc43a4dc67e8039348a33ef3d6edf8875cc6625
|