docs

Stacked PR Command Line Tool Documentation


Overview

The stkd CLI tool is designed to simplify the workflow of managing stacked pull requests. By automating common tasks such as creating, syncing, pushing, and converting branches into stacks, this tool helps developers focus on delivering high-quality code without worrying about the complexities of maintaining stack hierarchies.


Installation

www.stackedpr.com#signup

Commands

1. stkd new

Creates a new stack branch based on the current branch.

Usage

stkd new  

How it Works

Example Workflow

git checkout feature/add-login  
stkd new  
# Prompt: Enter the name for the new stack: feature/add-logout  
# Result: Creates a new branch `feature/add-logout` stacked on `feature/add-login`.  

2. stkd sync [--push]

Rebases all stack branches from their respective parent branches.

Usage

stkd sync  

Options

How it Works

Example Workflow

# Rebase all stacks locally:  
stkd sync  

# Rebase and push all stacks:  
stkd sync --push  

Output Example

Rebasing feature/add-logout onto feature/add-login...  
Rebasing feature/add-settings onto feature/add-logout...  
Sync complete!  

3. stkd push

Pushes all stack branches to the remote repository.

Usage

stkd push  

How it Works

Example Workflow

stkd push  
# Output: Pushing feature/add-login, feature/add-logout, and feature/add-settings to origin.  

4. stkd pr

Creates pull requests for all stack branches.

Usage

stkd pr  

How it Works

Example Workflow

stkd pr  
# Output:  
# Creating PR for feature/add-login...  
# Creating PR for feature/add-logout with base feature/add-login...  
# Creating PR for feature/add-settings with base feature/add-logout...  
# All PRs created successfully!  

5. stkd convert

Converts the current branch into a stack managed by stkd.

Usage

stkd convert  

How it Works

Example Workflow

git checkout feature/refactor-auth  
stkd convert  
# Prompt: Enter the parent branch for this stack: main  
# Output: feature/refactor-auth has been converted to a stack with parent main.  

Configuration

The stkd tool can be configured via a .stkdconfig file located in the root of your repository.

Sample .stkdconfig

{  
  "remote": "origin",  
  "defaultBranch": "main",  
  "prTemplate": ".github/pull_request_template.md",  
  "stackMetadataFile": ".stkd"  
}  

Options


Examples

Creating a New Stack

git checkout feature/add-login  
stkd new  
# Prompt: Enter the name for the new stack: feature/add-logout  
# Creates branch feature/add-logout based on feature/add-login.  

Syncing Stacks

stkd sync  
# Rebases all stack branches from their parent branches.  

Pushing Stacks

stkd push  
# Pushes all stack branches to the remote repository.  

Creating PRs

stkd pr  
# Creates a pull request for each stack branch, linking them in a hierarchical chain.  

Troubleshooting

Common Issues

Logging

For verbose output, use the --verbose flag:

stkd sync --verbose  

Support

For further assistance, please contact the development team or open an issue on our GitHub repository.