working-with-graphite
Original:🇺🇸 English
Translated
Use when managing branches and PRs with the Graphite CLI (gt). Covers creating stacked PRs, modifying mid-stack, submitting, syncing, and resolving conflicts.
9installs
Sourceneekolas/claude-skills
Added on
NPX Install
npx skill4agent add neekolas/claude-skills working-with-graphiteTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Working with Graphite
Core Principles
- Never commit to main All commits must be on a feature branch
- Do not create branches unless asked Do not create new branches unless explicitly requested to.
- Never use raw Git rebase -- always use commands to preserve stack metadata
gt - Always set Claude as the co-author when committing
Branch Strategy
- When creating plans, include the expected branches for each unit of work
- Pieces of work that span > 500 LOC should be broken into multiple branches and stacked onto one another
- Stack branches in a logical order, with discrete features in each branch.
- Each branch must be able to pass all lint, check, and test evaluations
Committing code
- Manually stage changes to impacted files using git commands. Do not use the flag to automatically stage all changes.
-a - For new features, create a commit using
gt modify --commit -m "description of the change" - For modifications to an existing feature or bug fixes, amend the commit using
gt modify
Submitting Changes
- When the task is complete, always and ensure that any impacted upstack branches are still valid (lint checks pass)
gt restack - Use when tasks are complete
gt submit --stack --update-only - If the changes are material, read the existing PR description and incorporate the changes. Do not overwrite the existing description losing important context.
- Present any changes to the PR description to the user for approval
Creating PR's
- Only submit a new PR with the user's explicit consent.
- Create the PR with . Always submit new PR's as a draft.
gt submit --draft - After submitting the PR, create a detailed PR description and submit it using the tool
gh - Ask the user for approval before submitting the PR description
Handling Conflicts
When conflicts occur during , , or :
gt syncgt restackgt modify- Resolve conflicts in affected files
- Stage resolved files:
git add <files> - Continue: or
gt continuegt continue --all
Workflow: Updating a Mid-Stack Branch
gt checkout <target-branch>- Make edits
- (amends and restacks upstack)
gt modify -a - (pushes all updated branches)
gt submit --stack --update-only --no-interactive
Common Gotchas
- Never -- breaks Graphite metadata. Use
git rebase -iinstead.gt move - Never -- use
git branch -dto preserve metadata.gt delete - Never -- use
git commit --amendwhich also restacks.gt modify -a - breaks PR links -- avoid renaming branches with existing PRs.
gt rename - Squash merges cause cascading conflicts -- +
gt syncresolves this.gt restack