$ account ezyang
ghstack is a Python CLI tool that enables developers to work with stacked pull requests on GitHub. It manages a stack of diffs as separate PRs using a specific branch naming convention (gh/username/N/{base,head,orig}). The tool provides subcommands for submitting, landing, checking out, pulling, cherry-picking, logging, syncing, unlinking, and managing stacked PRs. It interacts with GitHub via both GraphQL and REST APIs asynchronously (aiohttp) and relies heavily on git operations for branch and commit management. The codebase is modular with abstract endpoint classes for testability, a fake GitHub endpoint for offline testing, and a comprehensive test suite using custom pytest collection of .py.test files. Its primary value is enabling the 'stacked diff' workflow on GitHub, which is common in large engineering organizations but poorly supported natively.