Skip to main content

Git Branch Stacking Utility

Project description

Panqake - Git Branch Stacking Utility

Panqake is a CLI implementing the git-stacking workflow. It helps manage stacked branches, making it easier to work with multiple dependent pull requests.

Installation

  1. uv tool install panqake
    
  2. Dependencies:

    • gh: GitHub CLI (optional, only needed for PR creation)

Usage

Create a new branch in the stack

panqake new feature-login

This creates a new branch based on your current branch and tracks the relationship.

View the branch stack

panqake list

Displays a tree view of your current branch stack.

Track existing Git branches

panqake track

Adds an existing Git branch (created outside of panqake) to the stack tracking. The command will analyze the branch's history and prompt you to select a parent branch from potential candidates.

You can also specify a branch name:

panqake track feature-branch

Update branches after changes

panqake update

After making changes to a branch, this command rebases all child branches to incorporate your changes and pushes the updates to remote branches, updating any associated PRs.

To skip pushing to remote, use the --no-push flag:

panqake update --no-push

Delete a branch and relink the stack

panqake delete feature-old

Deletes a branch and relinks its children to its parent, maintaining the stack structure.

Create PRs for the branch stack

panqake pr

Creates pull requests for each branch in the stack, starting from the bottom.

Modify/amend commits

# Amend the current commit with changes
panqake modify

# Amend with a new commit message
panqake modify -m "New commit message"

# Create a new commit instead of amending
panqake modify --commit -m "New feature commit"

This command lets you modify your current commit by amending it or create a new commit.

Update remote branch and PR

panqake update-pr

After modifying commits, this command updates the remote branch and any associated PR. It handles force pushing with safeguards when necessary.

Note: The update command now includes this functionality by default. Use update-pr if you only want to push changes without rebasing child branches.

Merge PRs and manage the stack

# Merge the current branch's PR
panqake merge

# Merge a specific branch's PR
panqake merge feature-branch

# Merge without deleting the local branch
panqake merge --no-delete-branch

# Merge without updating child branches
panqake merge --no-update-children

This command merges a PR using GitHub CLI and performs post-merge management:

  • Deletes the local branch after merge (optional)
  • Updates all child branches to use the new parent branch
  • Rebases child branches onto the new base
  • Updates PR base references for child PRs

Workflow Example

  1. Start a new feature stack from main:

    git checkout main
    panqake new feature-base
    
  2. Make your initial changes and commit.

  3. Create a dependent branch for additional work:

    panqake new feature-ui
    
  4. Make changes and commit in the feature-ui branch.

  5. If you need to update the feature-base branch:

    git checkout feature-base
    # Make changes and commit
    panqake update
    
  6. If you need to modify a commit:

    # Make changes to files
    panqake modify -m "Updated implementation"
    panqake update-pr  # To update the remote branch and PR
    
  7. Create PRs for your stack:

    panqake pr
    
  8. When a PR is approved and ready to merge:

    panqake merge feature-base
    

    This will merge the PR, delete the local branch, and update all child branches automatically.

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Changelog

v0.1.1 (Unreleased)

  • Added merge command for merging PRs and managing the branch stack after merge
  • Added branch cleanup after successful merge
  • Added automatic rebasing of child branches after parent branches merge
  • Added updating of PR base references for child PRs
  • Added modify command for amending commits or creating new ones
  • Added update-pr command for updating remote branches and PRs
  • Improved force pushing with --force-with-lease for safety
  • Switched CLI interface from prompt_toolkit to questionary for improved user experience
  • Enhanced command-line prompts with better styling and autocomplete
  • Fixed styling issues in branch listing display
  • Improved output formatting for colored text
  • Added custom color scheme that works well on both light and dark terminals
  • Added documentation for the style system

v0.1.0

  • Initial release with core functionality
  • Branch stacking management
  • PR creation support

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

panqake-0.3.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

panqake-0.3.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file panqake-0.3.0.tar.gz.

File metadata

  • Download URL: panqake-0.3.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.16

File hashes

Hashes for panqake-0.3.0.tar.gz
Algorithm Hash digest
SHA256 06d80e85ef0c8f61c7134a929476a5669897c853366c8908328e429f2ff4eaa5
MD5 8f8c899e891e87965e6c02d8a4552b60
BLAKE2b-256 9ccfff2216c8370c2bfc398bb5876539d4c87079f8022c462caf3c56be65fafa

See more details on using hashes here.

File details

Details for the file panqake-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: panqake-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.16

File hashes

Hashes for panqake-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3070d15776c68637c91f3b127f79980d5e47138f323b073ec7ca686cd32ecf7
MD5 4a8bff0e7e1d1776e87310f88daba0dd
BLAKE2b-256 98c240e36149d61ce411db05c02a67f605092c6c0adb8f338141dd53db1f1d13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page