Catalogue / git-context
git-context
Apache-2.0SignedPatterns for working with git branches, remotes, diffs against the default branch, and rebases. Use when resolving rebase conflicts, continuing interactive rebases, amending commits, or any git operation that would open an interactive editor.--- name: git-context license: Apache-2.0 compatibility: Requires Git, Context for repository snapshots (its `context` Code Mode namespace, or the CLI through the context-cli skill), dotfiles Git helpers, and GitHub CLI for their workflows. Amendments use dot git commit. description: Patterns for working with git branches, remotes, diffs against the default branch, and rebases. Use when resolving rebase conflicts, continuing interactive rebases, amending commits, or any git operation that would open an interactive editor. ---
Git Context Patterns
Use this skill when working with branches, remotes, or comparing changes.
Repository context
For branch, working-tree, commit, diff and pull request context, including PR checks, reviews and comments, take a Context git snapshot: the context Code Mode namespace's git tool when the agent has it, otherwise load context-cli and run context git. That skill owns the options and output handling. For the diff against the default branch, use the CLI's --branch-diff when the tool has no diff option; the commits section lists the branch's commits.
context reads the local <remote>/HEAD without fetching. When the comparison must reflect the current remote, run git-default-ref first: it verifies and fetches the default branch.
Default branch helpers
Prefer the installed helpers over rebuilding default-branch operations with ad-hoc shell commands:
git-default-refis the guarded resolver used by all helpers. It prefersupstream, falls back toorigin, verifies local<remote>/HEADagainst the advertised default, and fetches it. A missing or mismatched ref requires human confirmation; underdot agent detector without a TTY it fails instead of prompting.git-switch-default(gsd) switches to the resolved default branch and fast-forwards it.git-rebase-default(grd) rebases the checked-out branch onto the resolved default with--autostash.graprints a status message and runsgit rebase --abort.
These commands are stowed from scripts/.local/bin/; the aliases are defined in zsh/.zshrc.
Rebases and Interactive Editor Operations
Continue, abort or skip a rebase, merge or cherry-pick with the git Code Mode tools when the agent has them. In a shell, prefix a continue with GIT_EDITOR=true (for example GIT_EDITOR=true git rebase --continue) so the editor accepts the default message; abort and skip open no editor.
For any requested commit amendment, load dot-git-commit and use its dot git commit --amend gateway flow instead of raw git commit --amend.
Resolving rebase conflicts
- When both sides are additive (independent features touching the same location), keep both.
- After replacing conflict markers, verify full method/function bodies are intact. Shared code between conflict markers is easily lost if not carefully included in the resolution.
- Stage resolved files with
git add. - Continue the rebase as above.
Ordinary commits are outside this skill. Load dot-git-commit after an explicit commit request and use its gateway.
Splitting a branch by changed files
Use this when a branch is too large and needs to be split into stacked branches with predictable file counts.
- Preferred helper script:
git-split-branch-by-files - Location:
~/.local/bin/git-split-branch-by-files - Naming: always
<source-branch>-b1,<source-branch>-b2, and so on
Default behavior:
- Splits against
origin/HEAD(fallbackdev,main, thenmaster) - Creates 5 branches by default
- Makes the first 4 branches equal in changed-file count by default (
--equal-up-to 4) - Puts any remainder into the tail branches
Typical commands:
# Preview only git-split-branch-by-files --source <branch> --base <base> --branches 5 --equal-up-to 4 --dry-run # Recreate output branches if they already exist git-split-branch-by-files --source <branch> --base <base> --branches 5 --equal-up-to 4 --force
Safety notes:
- Requires a clean worktree for real execution.
- Uses stacked output branches where each next branch is based on the previous split branch.
| File | Size | SHA-256 |
|---|---|---|
| SKILL.md | 4.1 kB | 7967c5db4e57 |
| SKILVAULT_SOURCE.json | 1.1 kB | debf24152750 |
| THIRD_PARTY_NOTICES.md | 11.4 kB | c0cbd8590956 |
Published verbatim from the pinned commit. Nothing is rewritten.
| Version | Pinned commit | Signed | |
|---|---|---|---|
| 0.1.0 Current | f1b2912f61d3 | 29 Nov 2026 |
Locking a skill to one version needs Pro.