Skip to main content

Minimal Git extension for working with multi-commit stacks

Project description

Stacky

Stacky is a minimal Git extension providing a stack-like workflow with one PR per stack, rather than one PR per commit. This allows for easier integration with GitHub's current PR workflow.

Since GitHub doesn't natively support stacked PRs, workarounds fall into one of three categories: serial PRs (simple but slow), parallel PRs (fast but complex and requiring permissions), or single PRs with multiple commits (fast but less flexible to review). Stacky implements the latter, with a simple and intuitive interface.

Concept

The main idea is every stack is just a branch FEATURE with linear history rooted at its base branch FEATURE_base.

(main)(FEATURE_base) > commit1 > commit2 > ... > commitN (FEATURE)

Successive commits move the stack's top branch, and rebases move the top-to-bottom stack of changes onto a new location.

One PR is created per stack, allowing reviewers to go through changes one commit at a time, while still testing and merging the stack as a single change.

Stacky is small and easy to understand, integrates natively with GitHub, and requires zero repo or org-level admin permissions or changes.

Usage

Stacky provides four commands to manage stacks:

  • hack FEATURE create a new stack named FEATURE
  • rebase TARGET rebase the current stack onto TARGET
  • stacks list all stacks, optionally as a --graph
  • absorb absorb changes into the current stack

Here's an example workflow:

# Help text
(main)   git stack -h

# 1. New stack (apple, apple_base branches rooted at main)
(main)   git stack hack apple
(apple)  touch apple1 && git add -A && git commit -m 'apple1'
(apple)  touch apple2 && git add -A && git commit -m 'apple2'

# 2. New stack (banana, banana_base branches rooted at main)
(apple)  git stack hack banana
(banana) touch banana1 && git add -A && git commit -m 'banana1'

# 3. Rebase banana onto apple
(banana) git stack rebase apple

# 4. Rebase banana implicitly back onto main
(banana) git stack rebase

# 5. Force-delete banana stack
(banana) git checkout apple
(apple)  git stack stack -D banana

# History evolution
# 1. (main)(apple_base) > apple1 > apple2 (apple)
# 2. (main)(apple_base)(banana_base) > apple1 > apple2 (apple)
#                                    > banana1 (banana)
# 3. (main)(apple_base) > apple1 > apple2 (apple)(banana_base) > banana1 (banana)
# 4. (main)(apple_base)(banana_base) > apple1 > apple2 (apple)
#                                    > banana1 (banana)
# 5. (main)(apple_base) > apple1 > apple2 (apple)

Install

Copy git-stack to a directory in your $PATH, and ensure it has executable permissions.

Recommendations

To complete the workflow: understand and install git-absorb, then use git stack absorb during regular development.

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

git_stacky-0.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

git_stacky-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file git_stacky-0.1.0.tar.gz.

File metadata

  • Download URL: git_stacky-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

File hashes

Hashes for git_stacky-0.1.0.tar.gz
Algorithm Hash digest
SHA256 661691e20b2be9b6a9a0e115146bd045cd30a66783fd1e391eb20e5b0889945d
MD5 8383d6800c4abc94355807407800ca05
BLAKE2b-256 c410c187a69d1a45e27b00806cc4752633209d895d5525fde325c25b57301bd5

See more details on using hashes here.

File details

Details for the file git_stacky-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: git_stacky-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.5 Darwin/23.6.0

File hashes

Hashes for git_stacky-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b694b629786684553b051a2bcc2f2651b37bef41c4bcfd1092148f09eb8daacf
MD5 8b9a431690653cfb0cf50311864b2aee
BLAKE2b-256 95dfd4f6cc295f0cf3c0e0f838086f126ba9fb8227a979340252e408359b21fc

See more details on using hashes here.

Supported by

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