Agent skill

Git Separate Tangled Changes Into PRs

by divinevideo in divinevideo/divine-mobile

Separate a messy working tree with multiple tangled features into clean, focused PRs.

MPL-2.0Auto-check passedDevelopment

Install Git Separate Tangled Changes Into PRs

skills CLI
$ npx skills add divinevideo/divine-mobile --skill git-separate-tangled-changes-into-prs -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install divinevideo/divine-mobile git-separate-tangled-changes-into-prs --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/divinevideo/divine-mobile.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/git-separate-tangled-changes-into-prs .claude/skills/git-separate-tangled-changes-into-prs && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
git-separate-tangled-changes-into-prs
GitHub stars
266
Token cost
~2.3k tokens
SKILL.md length
918 words
Files
1
Skills in repo
103
Repo updated
First seen
Licence
MPL-2.0

At a glance

Separate a messy working tree with multiple tangled features into clean, focused PRs.

  • Works in 8 steps: Stash Everything Safely → Create Clean Feature Branch → Pop Stash and Handle Conflicts → …
  • Working tree has uncommitted changes from multiple features mixed together
  • SKILL.md covers Problem, Context / Trigger Conditions, Solution and Verification, plus 2 more sections
  • Calls git, dart and gh

What it does

Git Separate Tangled Changes Into PRs is an agent skill from divinevideo/divine-mobile. Separate a messy working tree with multiple tangled features into clean, focused PRs. Use when: (1) Working tree has uncommitted changes from multiple features mixed together, (2) Need to create a PR for just one feature from a mixed working tree, (3) "git stash pop" fails with "already exists, no checkout" for untracked files, (4) Pre-commit hooks block commits due to unrelated untracked files with errors, (5) Interface changes in one feature break consumer files from another feature in the same working tree…

Its SKILL.md is about 2.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Git workflow. It works with Git. The licence is MPL-2.0.

When your agent uses it

  • Working tree has uncommitted changes from multiple features mixed together
  • Need to create a PR for just one feature from a mixed working tree
  • Git stash pop fails with already exists
  • No checkout for untracked files

Example prompts

  • “git stash pop”
  • “already exists, no checkout”
  • “/git-separate-tangled-changes-into-prs”

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Stash Everything Safely
  2. Create Clean Feature Branch
  3. Pop Stash and Handle Conflicts
  4. Handle Mixed-Change Files
  5. Deal with Pre-Commit Hooks That Check All Files
  6. Regenerate Generated Files
  7. Fix Interface Break Cascades
  8. Do NOT Stack PRs — Combine Dependent Features Into One PR

What it can do on your machine

Read from SKILL.md and the folder at commit 4c622be. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • git
    • dart
    • gh

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git and gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Git Separate Tangled Changes Into PRs loads about 2.3k tokens when it runs. Until then it costs about 173 tokens; SKILL.md has 918 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~173
When it runs · the whole SKILL.md, loaded when a task matches
~2.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from divinevideo/divine-mobile at commit 4c622be, republished under its MPL-2.0 licence (© divinevideo). 918 words, ~2,302 tokens.

Download SKILL.mdSave it as .claude/skills/git-separate-tangled-changes-into-prs/SKILL.md (or your agent's skills folder).
name
git-separate-tangled-changes-into-prs
description
Separate a messy working tree with multiple tangled features into clean, focused PRs. Use when: (1) Working tree has uncommitted changes from multiple features mixed together, (2) Need to create a PR for just one feature from a mixed working tree, (3) "git stash pop" fails with "already exists, no checkout" for untracked files, (4) Pre-commit hooks block commits due to unrelated untracked files with errors, (5) Interface changes in one feature break consumer files from another feature in the same working tree. Covers git stash workflows, branch separation, conflict resolution, and pre-commit hook workarounds. Never stack PRs — always target main.
author
Claude Code
version
1.2.0
date
2026-05-05

Separating Tangled Changes into Clean PRs

Problem

A working tree accumulates uncommitted changes from multiple features over time. When you need to create focused PRs, the changes are tangled together — some files have changes from multiple features, generated files (like .mocks.dart) reflect all features combined, and pre-commit hooks fail on unrelated WIP code.

Context / Trigger Conditions

  • Working tree has 50+ modified/untracked files spanning multiple features
  • git diff --name-only shows files from clearly different features
  • You need to create a PR for Feature A but Feature B's files cause analysis errors
  • Pre-commit hooks run dart analyze / eslint / etc. on ALL files (not just staged), so untracked WIP files block commits
  • Some files have changes from BOTH features (mixed-change files)

Solution

Step 1: Stash Everything Safely
bash
git stash -u -m "descriptive-name-for-safety"

The -u flag includes untracked files. This is your safety net.

Step 2: Create Clean Feature Branch
bash
git checkout main  # or the appropriate base
git pull
git checkout -b feature/clean-branch
Step 3: Pop Stash and Handle Conflicts
bash
git stash pop

Common issue: "already exists, no checkout" — happens when untracked files from the stash already exist in the working tree. The tracked file changes still apply, but the stash is preserved (not dropped). This is safe; the files you need are already there.

Merge conflicts: Resolve each one. For files belonging to OTHER features, take the base version:

bash
git checkout --theirs path/to/other-feature-file.dart

For files belonging to THIS feature, take the stash version or resolve manually.

Step 4: Handle Mixed-Change Files

Some files have changes from BOTH features. For these:

  1. Restore to the base version: git checkout main -- path/to/file.dart
  2. Re-apply ONLY your feature's changes manually (usually just import changes or a few lines)
Step 5: Deal with Pre-Commit Hooks That Check All Files

If your pre-commit hook analyzes ALL files (not just staged), untracked WIP files from other features will block your commit.

Workaround: Temporarily move problematic untracked files:

bash
mkdir -p /tmp/other-features-backup
mv lib/unrelated_feature/ /tmp/other-features-backup/
mv test/unrelated_feature/ /tmp/other-features-backup/

Commit, then restore:

bash
cp -r /tmp/other-features-backup/* .
Step 6: Regenerate Generated Files

If the project uses code generation (Mockito, Riverpod, Freezed, etc.), restore generated files to base and regenerate:

bash
git checkout main -- **/*.mocks.dart **/*.g.dart
dart run build_runner build --delete-conflicting-outputs

This ensures generated files only reflect YOUR feature's changes.

Step 7: Fix Interface Break Cascades

When Feature A changes an interface (renames a method, changes parameter types), consumer files that weren't modified by Feature A will break. The analyzer catches these. Fix them before committing.

Common pattern:

  • Provider state changed CompleteParameters? to Map<String, dynamic>
  • Canvas widget still calls .colorFilters on what's now a Map
  • Fix: Update the consumer to use the new interface
Step 8: Do NOT Stack PRs — Combine Dependent Features Into One PR

Never create a PR that targets another PR's branch instead of main. Stacked PRs cause real problems in this project: rebases cascade, reviewer context fragments, merge order becomes load-bearing, CI runs against the wrong base, and "fix on parent" forces a re-review of the child.

If Feature B depends on Feature A, ship them as ONE combined PR.

bash
# Both features live on a single branch, targeting main
git checkout main && git pull
git checkout -b feature-a-and-b
# ... commit Feature A changes ...
# ... commit Feature B changes (separate commits are fine) ...
gh pr create --base main  # one PR, both features

Write the PR description so the two features are clearly delineated — separate sections, separate test plans. Reviewers can read it as a single unit, and the merge story is one click. This is the default when changes are interdependent.

The only time to split is when the features are truly independent — in which case they each get their own PR targeting main, in any order. If you find yourself wanting "B based on A," that's the signal to combine them, not to stack.

Show full SKILL.md (374 more words)Show less

Verification

  1. git diff main...HEAD --stat shows only files for YOUR feature
  2. dart analyze (or equivalent) passes
  3. Tests pass
  4. Original stash still exists as safety net (if pop failed partially): git stash list

Example

Session where model-dedup changes and collaborator/watermark feature changes were tangled in 140+ modified files. The model-dedup work was independent of the collab/watermark feature, so they split cleanly:

  1. Stashed everything from fix/profile-copy-shares-url
  2. Created chore/model-deduplication from main, popped stash
  3. Separated model-dedup files, moved 16 untracked feature files to /tmp/
  4. Committed, pushed, created PR #1411 (target: main)
  5. Created feat/collabs-watermark-inspired-by from main, popped stash
  6. Fixed 3 interface breaks in video_editor_canvas.dart and video_metadata_preview_thumbnail.dart
  7. Committed, pushed, created PR #1412 (target: main — independent of #1411)

If the two features had been interdependent, they would have shipped as one combined PR — never stacked.

Alternative: Cherry-Pick Commits + Selective Stash Apply

When changes are split between commits AND stash (not just stash), use this approach instead:

bash
# 1. Create branches from origin/main
git branch feature-a origin/main
git branch feature-b origin/main

# 2. Cherry-pick commits to appropriate branches
git checkout feature-a
git cherry-pick <commit-hash-for-feature-a>

# 3. Apply stashed files selectively (see gotchas below)
GOTCHA: Deleted Files in Stash

git checkout stash@{0} -- <path> FAILS for files that were DELETED in the stash — they don't exist in the stash tree. Handle deletions separately:

bash
# For MODIFIED files — checkout from stash works
git checkout stash@{0} -- path/to/modified_file.dart

# For DELETED files — must use git rm instead
git rm path/to/deleted_file.dart

# Check which are deletions vs modifications first:
git stash show stash@{0} --name-status
# D = deleted (use git rm), M = modified (use checkout)
GOTCHA: Mono-Repo Stash Path Prefixes

When git root is a parent directory but you work in a subdirectory, stash paths include the subdirectory prefix:

bash
# Working in: /project/mobile/
# Git root:   /project/
# Stash shows: mobile/lib/file.dart (NOT lib/file.dart)

# Must run checkout from repo root:
cd $(git rev-parse --show-toplevel)
git checkout stash@{0} -- mobile/lib/file.dart
GOTCHA: Cherry-Pick Produces Empty Commit

If a commit was already merged to main via a different PR (different hash), cherry-pick will produce an empty commit:

bash
# "The previous cherry-pick is now empty"
git cherry-pick --skip  # Skip it, it's already on main
GOTCHA: Pre-Commit Hooks on Cherry-Picked Branches

When cherry-picking onto branches from origin/main, the analyzer may find pre-existing errors on main unrelated to your changes. Use --no-verify only when you've confirmed the errors aren't yours:

bash
git commit --no-verify -m "feat: your changes"
Verify Completeness

Compare stash contents against all branch diffs:

bash
git stash show stash@{0} --name-only | sort > /tmp/stash_files.txt
git diff --name-only origin/main..feature-a
git diff --name-only origin/main..feature-b
# Every stash file should appear in exactly one branch

Notes

  • Always stash with -u to capture untracked files
  • Never force-drop a stash until you've verified everything is safe
  • Mixed-change files are the hardest part — identify them early by checking which files have changes from multiple features
  • Pre-commit hooks that check all files (not just staged) are the biggest blocker. Know your project's hook behavior before starting.
  • Never stack PRs. Always target main. If features depend on each other, combine them into one bigger PR — see Step 8.
  • The stash is preserved when pop fails on untracked files — don't panic, your data is safe

© divinevideo, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/git-separate-tangled-changes-into-prs of divinevideo/divine-mobile.

Open the folder on GitHubat commit 4c622be

Compare with similar skills

Git Separate Tangled Changes Into PRs next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Git Separate Tangled Changes Into PRs compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Git Separate Tangled Changes Into PRs this skilldivinevideo/divine-mobile266—~2.3kAutomated safety check: PassMPL-2.0
Finishing a Development Branchobra/superpowers296k5 repos~1.9kAutomated safety check: PassMIT
Code Design Rationale Investigatorcursor/plugins10k9 repos~2.6kAutomated safety check: PassNone
Contributor-First PR MergeHKUDS/OpenHarness16k1 repos~847Automated safety check: PassMIT
Migrate Internal Package into GhostTryGhost/Ghost55k—~3.8kAutomated safety check: PassMIT
Create Pull Requestcline/cline70k1 repos~1.6kAutomated safety check: PassApache-2.0

Similar skills

  • Walks the last step of a branch: confirm tests pass, detect the git environment, ask how to integrate, carry out your choice and clean up the worktree.

    296k GitHub starsUsed in 5 repos~1.9k tokens
    DevelopmentAuto-check passed
  • Official

    Digs into why code is shaped the way it is by checking git history, pull requests and connected tools in parallel, then reporting a cited read on the tradeoffs.

    10k GitHub starsUsed in 9 repos~2.6k tokens
    DevelopmentAuto-check passed
  • Merges external GitHub pull requests while keeping the original author credited, and fixes conflicts after the merge instead of rewriting the contribution.

    16k GitHub starsUsed in 1 repo~847 tokens
    DevelopmentAuto-check passed
  • Moves a package from another TryGhost repository into Ghost as an internal workspace package while keeping its Git history, with checkpoints for the steps that need an administrator.

    55k GitHub stars~3.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Opens a GitHub pull request from your current branch with the gh CLI, after reviewing the commits and diff and gathering the details the PR needs.

    70k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Git Merge Conflict Resolver

    tailcallhq/forgecode

    Resolves Git merge conflicts with a plan-first workflow that keeps both sides' intent, regenerates lock files and backs up deleted-but-modified files.

    7.6k GitHub starsUsed in 1 repo~4.5k tokens
    DevelopmentAuto-check passed

More from divinevideo/divine-mobile

All 103 skills in this repo
  • Fix ArgoCD ExternalSecret deployment failing with "namespace X is not permitted in project Y".

    266 GitHub stars~931 tokensUpdated today
    Auto-check passed
  • Art Direct

    divinevideo/divine-mobile

    Art direction for any content — reads text, PDF, Word, HTML, PPT, then proposes 2-3 creative directions with photography style, mood, and visual language.

    266 GitHub stars~4.8k tokensUpdated today
    Auto-check passed
  • Async Await Null Race Condition

    divinevideo/divine-mobile

    Fix "Null check operator used on a null value" errors when an object is set to null during an async await.

    266 GitHub stars~881 tokensUpdated today
    Auto-check passed
  • AWS V4 Signing Custom Headers Gcs

    divinevideo/divine-mobile

    Add custom metadata headers (x-amz-meta-) to AWS v4 signed requests for GCS S3-compatible API.

    266 GitHub stars~1k tokensUpdated today
    Auto-check passed
  • Bash Herestring Newline Secrets

    divinevideo/divine-mobile

    Fix password/secret authentication failures caused by trailing newlines when creating Google Cloud secrets (or similar) with bash here-strings.

    266 GitHub stars~791 tokensUpdated today
    Auto-check passed
  • Fix silent video/media processing failures caused by URL extraction code that filters on file extensions (.mp4, .webm, .webp).

    266 GitHub stars~1.1k tokensUpdated today
    Auto-check passed

Works with

Categories

Questions about Git Separate Tangled Changes Into PRs

What does Git Separate Tangled Changes Into PRs do?

Separate a messy working tree with multiple tangled features into clean, focused PRs. Git Separate Tangled Changes Into PRs is an agent skill from divinevideo/divine-mobile. Separate a messy working tree with multiple tangled features into clean, focused PRs.

When should I use Git Separate Tangled Changes Into PRs?

Git Separate Tangled Changes Into PRs fits situations like: working tree has uncommitted changes from multiple features mixed together; need to create a PR for just one feature from a mixed working tree; Git stash pop fails with already exists; no checkout for untracked files.

How do I install Git Separate Tangled Changes Into PRs in Claude Code?

Run `npx skills add divinevideo/divine-mobile --skill git-separate-tangled-changes-into-prs -a claude-code`. Or copy the skill folder (.agents/skills/git-separate-tangled-changes-into-prs in divinevideo/divine-mobile) into .claude/skills/git-separate-tangled-changes-into-prs in your project. Claude Code loads it when a task matches its description.

How do I install Git Separate Tangled Changes Into PRs in Codex?

Run `npx skills add divinevideo/divine-mobile --skill git-separate-tangled-changes-into-prs -a codex`. Or copy the skill folder (.agents/skills/git-separate-tangled-changes-into-prs in divinevideo/divine-mobile) into .agents/skills/git-separate-tangled-changes-into-prs in your project. Codex loads it when a task matches its description.

Can I use Git Separate Tangled Changes Into PRs in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add divinevideo/divine-mobile --skill git-separate-tangled-changes-into-prs -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/git-separate-tangled-changes-into-prs, .gemini/skills/git-separate-tangled-changes-into-prs, .github/skills/git-separate-tangled-changes-into-prs and .opencode/skills/git-separate-tangled-changes-into-prs in your project.

What does Git Separate Tangled Changes Into PRs need to run?

Going by SKILL.md and its folder, Git Separate Tangled Changes Into PRs needs the command-line tools its instructions call (git, dart and gh).

Does Git Separate Tangled Changes Into PRs access the network?

SKILL.md contains no URLs. Its commands use git and gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Git Separate Tangled Changes Into PRs safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Git Separate Tangled Changes Into PRs use?

Git Separate Tangled Changes Into PRs is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Git Separate Tangled Changes Into PRs use?

About 2.3k tokens (SKILL.md is roughly 9.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Git Separate Tangled Changes Into PRs?

Skills that share tags, products or a category with Git Separate Tangled Changes Into PRs: Finishing a Development Branch (obra/superpowers, 296k stars), Code Design Rationale Investigator (cursor/plugins, 10k stars), Contributor-First PR Merge (HKUDS/OpenHarness, 16k stars) and Migrate Internal Package into Ghost (TryGhost/Ghost, 55k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Git Separate Tangled Changes Into PRs?

divinevideo (a GitHub organization) maintains it in divinevideo/divine-mobile, which has 266 GitHub stars. The repository holds 103 skills in this directory. The repository was last updated on October 8, 2026.

Source: divinevideo/divine-mobile on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.