code:stacked-commit

Manage stacked commits using Graphite. Use when the user wants to create multiple stacked commits, manage a commit stack, sync with remote, or submit PRs from a stack. Triggers on "stacked", "stack", "gt ", "graphite", or when working with multiple related commits.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "code:stacked-commit" with this command: npx skills add martinffx/atelier/martinffx-atelier-code-stacked-commit

Stacked Commit Skill (Graphite)

Manage stacked commits using Graphite - a CLI for creating and managing stacked PRs.

When to Use

  • User wants to break work into multiple small, reviewable commits
  • Working with stacked commits (multiple commits stacked on each other)
  • Syncing and submitting stacked PRs

Prerequisites

Ensure Graphite is installed:

brew install graphite-dev || npm install -g @graphite-dev/cli

Core Operations

1. View Current Stack

gt stack

Shows all branches in the stack with their status (synced, to-push, in-progress).

2. Create a New Commit

gt branch create "feat(auth): add JWT authentication"

This:

  1. Creates a new branch on top of the current stack
  2. Opens editor for commit message (or use -m for inline)
  3. Commits the staged changes

Works best when you:

  • Stage specific files: git add file1 file2
  • Then create commit: gt branch create "feat: add feature"
  • Repeat for each logical unit of work

3. Restack (Rebase onto Main)

gt branch restack

Rebases all branches in the stack onto the latest main. Use before submitting or when main has advanced.

4. Sync with Remote

gt branch sync

Pull latest changes from remote and restack.

5. Submit Stack as PRs

gt branch submit

Creates PRs for each branch in the stack. Opens browser to create the first PR; subsequent PRs link to it.

6. Continue Working on Branch

If you need to add more changes to a specific commit:

# Make your changes, stage them
git add .

# Amend to current branch
gt branch continue

7. Navigate Stack

# Go to parent branch
gt branch checkout @parent

# Go to child branch  
gt branch checkout @child

Workflow Example

# Start new feature work
git checkout main
gt branch create "feat(api): add user endpoint"

# Add user endpoint code
git add src/users/
gt branch continue  # Amend to current commit

# Create next commit in stack
gt branch create "feat(api): add user validation"

# Add validation code  
git add src/validation/
gt branch continue

# View stack
gt stack

# Restack before submit
gt branch restack

# Submit all as stacked PRs
gt branch submit

Best Practices

  1. One logical change per commit - Each commit should be reviewable independently
  2. Meaningful commit messages - Use conventional commit format
  3. Restack before submit - Always gt branch restack before submitting to ensure clean history
  4. Keep stack small - Deep stacks can be hard to manage; 3-5 commits is ideal
  5. Sync regularly - Run gt branch sync often when working with others

Troubleshooting

IssueSolution
Conflicts during restackResolve in editor, then gt branch continue
Stack brokengt branch repair to fix detached HEAD
Too many branchesgt branch delete <name> to remove (won't delete remote)

Commit Message Format

Follow conventional commits within the Graphite workflow:

<type>(<scope>): <subject>

[optional body]

Examples:

feat(api): add user profile endpoint
fix(db): resolve connection pool exhaustion
docs(readme): update installation instructions

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

python:architecture

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python:build-tools

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python:sqlalchemy

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python:testing

No summary provided by upstream source.

Repository SourceNeeds Review