Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
77a5d62
Adding upstack as bottom and also adding option to merge vs rebase (#1)
yashNaN Aug 1, 2024
4a0ffab
Adding --a option to stacky commit (#2)
yashNaN May 30, 2025
93ce44c
Merge branch 'rockset:master' into master
yashNaN May 30, 2025
eb4b6e4
New command stacky branch commit which will create a branch and commi…
yashNaN Jun 3, 2025
f961e71
Adding new command stacky inbox to show PR inbox (#4)
yashNaN Jun 3, 2025
bfbb6e8
Fixing issue with infinite recursion when getting config not in a git…
yashNaN Jun 3, 2025
8d540ff
Adding functionality to stacky inbox to alsio list if checks have pas…
yashNaN Jun 4, 2025
243014f
Cleaning up and simplifying stacky inbox code (#7)
yashNaN Jun 4, 2025
b3c77a3
Adding --no-verify flag to skip precommit hooks (#8)
yashNaN Jun 4, 2025
18f1f9e
Adding stacky fold command to fold a branch into parent (#9)
yashNaN Jun 5, 2025
6ba8370
Cleaning up get_commits_between_branches (#10)
yashNaN Jun 5, 2025
52bda48
Stack update will clean up deleted branch refs (#11)
yashNaN Jun 5, 2025
2039e19
Making stacky inbox track draft PRs (#12)
yashNaN Jun 6, 2025
a31d309
Adding new command stacky prs to interactive modify PR description (#13)
yashNaN Jun 17, 2025
59124c5
Adding autocomplete options for stacky branch (#14)
yashNaN Jun 30, 2025
e36b2c3
updating readme directions to locally instally using pip (#15)
yashNaN Jun 30, 2025
afbf290
Adding stacky comment when pushing up the PR (#16)
yashNaN Jul 3, 2025
b5dc677
Include stacky stack comment on the top most PR of a stack as well (#18)
yashNaN Jul 8, 2025
846c21c
Adding a stack log command that shows the git log similarly whether u…
yashNaN Jul 17, 2025
b0bd7e1
Stacky comment shows current pr in the comment (#21)
yashNaN Jul 22, 2025
7c5db61
chore: confirm - or y (#20)
roopakv Jul 23, 2025
3340152
Including entire forest for stacky comment (#22)
yashNaN Aug 5, 2025
d09a8c3
Stacky comment now includes PR status as of last push (#23)
yashNaN Aug 5, 2025
c50e233
Adding PR status emojis to stacky info --pr, also have a new UI optio…
yashNaN Aug 5, 2025
0de3e94
Update readme with stacky config (#25)
sfc-gh-ynannapaneni Sep 11, 2025
45bfad4
Making stacky pr comment toggleable (#26)
sfc-gh-ynannapaneni Oct 22, 2025
71dc4cd
Updating readme with info on enable_stack_comment (#27)
sfc-gh-ynannapaneni Oct 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ py_binary(
requirement("ansicolors"),
requirement("simple-term-menu"),
requirement("asciitree"),
requirement("argcomplete"),
]
)

Expand Down
99 changes: 91 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,75 @@ There is also a [xar](https://github.com/facebookincubator/xar/) version it shou

### Pip
```
pip3 install rockset-stacky
1. Clone this repository
2. From this repository root run `pip install -e .`
```

### Manual
`stacky` requires the following python3 packages installed on the host
1. asciitree
2. ansicolors
3. simple-term-menu
4. argcomplete (for tab completion)
```
pip3 install asciitree ansicolors simple-term-menu
pip3 install asciitree ansicolors simple-term-menu argcomplete
```

After which `stacky` can be directly run with `./src/stacky/stacky.py`. We would recommend symlinking `stacky.py` into your path so you can use it anywhere

## Tab Completion

Stacky supports tab completion for branch names in bash and zsh. To enable it:

### One-time setup
```bash
# Install argcomplete
pip3 install argcomplete

# Enable global completion (recommended)
activate-global-python-argcomplete
```

### Per-session setup (alternative)
If you prefer not to use global completion, you can enable it per session:
```bash
# For bash/zsh
eval "$(register-python-argcomplete stacky)"
```

### Permanent setup (alternative)
Add the completion to your shell config:
```bash
# For bash - add to ~/.bashrc
eval "$(register-python-argcomplete stacky)"

# For zsh - add to ~/.zshrc
eval "$(register-python-argcomplete stacky)"
```

After setup, you can use tab completion with commands like:
- `stacky checkout <TAB>` - completes branch names
- `stacky adopt <TAB>` - completes branch names
- `stacky branch checkout <TAB>` - completes branch names

## Accessing Github
Stacky doesn't use any git or Github APIs. It expects `git` and `gh` cli commands to work and be properly configured. For instructions on installing the github cli `gh` please read their [documentation](https://cli.github.com/manual/).

## Usage
`stacky` stores all information locally, within your git repository
Syntax is as follows:
- `stacky info`: show all stacks , add `-pr` if you want to see GitHub PR numbers (slows things down a bit)
- `stacky info`: show all stacks , add `-pr` if you want to see GitHub PR numbers (slows things down a bit)
- `stacky inbox [--compact]`: show all active GitHub pull requests for the current user, organized by status (waiting on you, waiting on review, approved, and PRs awaiting your review). Use `--compact` or `-c` for a condensed one-line-per-PR view with clickable PR numbers.
- `stacky prs`: interactive PR management tool that allows you to select and edit PR descriptions. Shows a simple menu of all your open PRs and PRs awaiting your review, then opens your preferred editor (from `$EDITOR` environment variable) to modify the selected PR's description.
- `stacky branch`: per branch commands (shortcut: `stacky b`)
- `stacky branch up` (`stacky b u`): move down the stack (towards `master`)
- `stacky branch down` (`stacky b d`): move down the stack (towards `master`)
- `stacky branch down` (`stacky b d`): move down the stack (towards `master`)
- `stacky branch new <name>`: create a new branch on top of the current one
- `stacky commit [-m <message>] [--amend] [--allow-empty]`: wrapper around `git commit` that syncs everything upstack
- `stacky branch commit <name> [-m <message>] [-a]`: create a new branch and commit changes in one command
- `stacky commit [-m <message>] [--amend] [--allow-empty] [-a]`: wrapper around `git commit` that syncs everything upstack
- `stacky amend`: will amend currently tracked changes to top commit
- Based on the first argument (`stack` vs `upstack` vs `downstack`), the following commands operate on the entire current stack, everything upstack from the current PR (inclusive), or everything downstack from the current PR:
- `stacky fold [--allow-empty]`: fold current branch into its parent branch and delete the current branch. Any children of the current branch become children of the parent branch. Uses cherry-pick by default, or merge if `use_merge` is enabled in config. Use `--allow-empty` to allow empty commits during cherry-pick.
- Based on the first argument (`stack` vs `upstack` vs `downstack`), the following commands operate on the entire current stack, everything upstack from the current PR (inclusive), or everything downstack from the current PR:
- `stacky stack info [--pr]`
- `stacky stack sync`: sync (rebase) branches in the stack on top of their parents
- `stacky stack push [--no-pr]`: push to origin, optionally not creating PRs if they don’t exist
Expand All @@ -56,12 +96,12 @@ The indicators (`*`, `~`, `!`) mean:
```
$ stacky --help
usage: stacky [-h] [--color {always,auto,never}]
{continue,info,commit,amend,branch,b,stack,s,upstack,us,downstack,ds,update,import,adopt,land,push,sync,checkout,co,sco} ...
{continue,info,commit,amend,branch,b,stack,s,upstack,us,downstack,ds,update,import,adopt,land,push,sync,checkout,co,sco,inbox,prs,fold} ...

Handle git stacks

positional arguments:
{continue,info,commit,amend,branch,b,stack,s,upstack,us,downstack,ds,update,import,adopt,land,push,sync,checkout,co,sco}
{continue,info,commit,amend,branch,b,stack,s,upstack,us,downstack,ds,update,import,adopt,land,push,sync,checkout,co,sco,inbox,prs,fold}
continue Continue previously interrupted command
info Stack info
commit Commit
Expand All @@ -71,12 +111,16 @@ positional arguments:
upstack (us) Operations on the current upstack
downstack (ds) Operations on the current downstack
update Update repo
import Import Graphite stack
adopt Adopt one branch
land Land bottom-most PR on current stack
push Alias for downstack push
sync Alias for stack sync
checkout (co) Checkout a branch
sco Checkout a branch in this stack
inbox List all active GitHub pull requests for the current user
prs Interactive PR management - select and edit PR descriptions
fold Fold current branch into parent branch and delete current branch

optional arguments:
-h, --help show this help message and exit
Expand Down Expand Up @@ -166,6 +210,7 @@ In the file you have sections and each sections define some parameters.

We currently have the following sections:
* UI
* GIT

List of parameters for each sections:

Expand All @@ -174,6 +219,44 @@ List of parameters for each sections:
* change_to_main: boolean with a default value of `False`, by default `stacky` will stop doing action is you are not in a valid stack (ie. a branch that was created or adopted by stacky), when set to `True` `stacky` will first change to `main` or `master` *when* the current branch is not a valid stack.
* change_to_adopted: boolean with a default value of `False`, when set to `True` `stacky` will change the current branch to the adopted one.
* share_ssh_session: boolean with a default value of `False`, when set to `True` `stacky` will create a shared `ssh` session to the `github.com` server. This is useful when you are pushing a stack of diff and you have some kind of 2FA on your ssh key like the ed25519-sk.
* compact_pr_display: boolean with a default value of `False`, when set to `True` `stacky info --pr` will show a compact format displaying only the PR number and status emoji (✅ approved, ❌ changes requested, 🔄 waiting for review, 🚧 draft) without the PR title. Both compact and full formats include clickable links to the PRs.
* enable_stack_comment: boolean with a default value of `True`, when set to `False` `stacky` will not post stack comments to GitHub PRs showing the entire stack structure. Disable this if you don't want automated stack comments in your PR descriptions.

### GIT
* use_merge: boolean with a default value of `False`, when set to `True` `stacky` will use `git merge` instead of `git rebase` for sync operations and `stacky fold` will merge the child branch into the parent instead of cherry-picking individual commits.
* use_force_push: boolean with a default value of `True`, controls whether `stacky` can use force push when pushing branches.

### Example Configuration

Here's a complete example of a `.stackyconfig` file with all available options:

```ini
[UI]
# Skip confirmation prompts (useful for automation)
skip_confirm = False

# Automatically change to main/master when not in a valid stack
change_to_main = False

# Change to the adopted branch after running 'stacky adopt'
change_to_adopted = False

# Create shared SSH session for multiple operations (helpful with 2FA)
share_ssh_session = False

# Show compact format for 'stacky info --pr' (just number and emoji)
compact_pr_display = False

# Enable posting stack comments to GitHub PRs
enable_stack_comment = True

[GIT]
# Use git merge instead of rebase for sync operations
use_merge = False

# Allow force push when pushing branches
use_force_push = True
```

## License

Expand Down
Loading
Loading