Skip to content
Back to skills

Git Context

ASecurity

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.

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added November 24, 2026
toolsshellbashgit

Works with

  • cli

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add timmo001/skills --skill git-context --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Git Context?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Git Context
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/timmo001-git-context/badge)](https://www.skillsdirectory.com/skills/timmo001-git-context)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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-ref` is the guarded resolver used by all helpers. It prefers `upstream`, falls back to `origin`, verifies local `<remote>/HEAD` against the advertised default, and fetches it. A missing or mismatched ref requires human confirmation; under `dot agent detect` or 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`.
- `gra` prints a status message and runs `git 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

1. When both sides are additive (independent features touching the same location), keep both.
2. 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.
3. Stage resolved files with `git add`.
4. 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` (fallback `dev`, `main`, then `master`)
- 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:

```bash
# 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.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in tools →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.