`stacky` is a homebrewed tool to manage stacks of PRs. This allows developers to easily manage many smaller, more targeted PRs that depend on each other.
## Installation
You now have the choice on how to do that, we build pre-packaged version of stacky on new releases, they can be found on the [releases](https://github.com/rockset/stacky/releases) page and we also publish a package in `pypi`.
### Pre-packaged
Using `bazel` we provide pre-packaged version, they are self contained and don't require the installation of external modules. Just drop them in a directory that is part of the `$PATH` environment variable make it executable and you are good to go.
There is also a [xar](https://github.com/facebookincubator/xar/) version it should be faster to run but requires to have `xarexec_fuse` installed.
### Pip
```
pip3 install rockset-stacky
```
### Manual
`stacky` requires the following python3 packages installed on the host
1. asciitree
2. ansicolors
3. simple-term-menu
```
pip3 install asciitree ansicolors simple-term-menu
```
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
## 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 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 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 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 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
- `stacky upstack onto <target>`: restack the current branch (and everything upstack from it) on top of another branch (like `gt us onto`), useful if you’ve made a separate PR that you want to include in your stack
- `stacky continue`: continue an interrupted stacky sync command (because of conflicts)
- `stacky update`: will pull changes from github and update master, and deletes branches that have been merged into master
The indicators (`*`, `~`, `!`) mean:
- `*` — this is the current branch
- `~` — the branch is not in sync with the remote branch (you should push)
- `!` — the branch is not in sync with its parent in the stack (you should run `stacky stack sync`, which will do some rebases)
```
$ 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} ...
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 Continue previously interrupted command
info Stack info
commit Commit
amend Shortcut for amending last commit
branch (b) Operations on branches
stack (s) Operations on the full current stack
upstack (us) Operations on the current upstack
downstack (ds) Operations on the current downstack
update Update repo
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
optional arguments:
-h, --help show this help message and exit
--color {always,auto,never}
Colorize output and error
```
### Sample Workflow
1. Create a new working branch with `stacky branch new <branch_name>`.
2. Update files and add files to git tracking like normal (`git add`)
3. Commit updates with `stacky commit -m <commit_message>`
4. Create a stacked branch with `stacky branch new <downstack_branch_name>`
5. Update files and add files in downstack branch (`git add`)
6. `stacky push` will create 2 PRs. Top branch will have a PR against master and bottom branch will have a PR against the top branch.
7. Update the upstack branch and run `stacky commit`. This will rebase changes in the upstack branch to the downstack branch
8. `stacky push` will update both the PRs.
```
$> stacky branch new change_part_1
branch 'change_part_1' set up to track 'master'.
$> touch adding_new_file
$> git add adding_new_file
$> stacky commit -m "Added new file"
[change_part_1 23b102a] Added new file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 adding_new_file
~* change_part_1
✓ Not syncing branch change_part_1, already synced with parent master
$> stacky branch new change_part_2
branch 'change_part_2' set up to track 'change_part_1'.
$> touch second_file
$> git add second_file
$> stacky commit -m "Added second file"
[change_part_2 0805f57] Added second file
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 second_file
~* change_part_2
✓ Not syncing branch change_part_2, already synced with parent change_part_1
$> stacky info
│ ┌── ~* change_part_2
├── ~ change_part_1
master
$> stacky push
┌── ~* change_part_2
┌── ~ change_part_1
master
✓ Not pushing base branch master
- Will push branch change_part_1 to origin/change_part_1
- Will create PR for branch change_part_1
- Will push branch change_part_2 to origin/change_part_2
- Will create PR for branch change_part_2
Proceed? [yes/no] yes
Pushing change_part_1
Creating PR for change_part_1
? Title change part 1
? Body <Received>
? What's next? Submit as draft
https://github.com/rockset/stacky/pull/2
Pushing change_part_2
Creating PR for change_part_2
? Title Added second file
? Body <Received>
? What's next? Submit as draft
https://github.com/rockset/stacky/pull/3
$> git co change_part_1
$> vim adding_new_file
$> git add adding_new_file
$> stacky commit -m "updated new file"
[change_part_1 aa06f71] updated new file
1 file changed, 1 insertion(+)
┌── !~ change_part_2
~* change_part_1
✓ Not syncing branch change_part_1, already synced with parent master
- Will sync branch change_part_2 on top of change_part_1
```
## Tuning
The behavior of `stacky` allow some tuning. You can tune it by creating a `.stackyconfig`
the file has to be either at the top of your repository (ie. next to the `.git` folder) or in the `$HOME` folder.
If both files exists the one in the home folder takes precedence.
The format of that file is following the `ini` format and has the same structure as the `.gitconfig` file.
In the file you have sections and each sections define some parameters.
We currently have the following sections:
* UI
List of parameters for each sections:
### UI
* skip_confirm, boolean with a default value of `False`, set it to `True` to skip confirmation before doing things like reparenting or removing merged branches.
* 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.
## License
- [MIT License](https://github.com/rockset/stacky/blob/master/LICENSE.txt)
Raw data
{
"_id": null,
"home_page": "https://github.com/rockset/stacky",
"name": "rockset-stacky",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8, <4",
"maintainer_email": "",
"keywords": "github,stack,pr,pull request",
"author": "Rockset",
"author_email": "tudor@rockset.com",
"download_url": "https://files.pythonhosted.org/packages/de/5a/3426af93cc1da1b7c8587bf1d7c12533d25a3702ec88eeb2a330b1a08efe/rockset-stacky-1.0.13.tar.gz",
"platform": null,
"description": "`stacky` is a homebrewed tool to manage stacks of PRs. This allows developers to easily manage many smaller, more targeted PRs that depend on each other.\n\n\n## Installation\nYou now have the choice on how to do that, we build pre-packaged version of stacky on new releases, they can be found on the [releases](https://github.com/rockset/stacky/releases) page and we also publish a package in `pypi`.\n\n### Pre-packaged\n\nUsing `bazel` we provide pre-packaged version, they are self contained and don't require the installation of external modules. Just drop them in a directory that is part of the `$PATH` environment variable make it executable and you are good to go.\n\nThere is also a [xar](https://github.com/facebookincubator/xar/) version it should be faster to run but requires to have `xarexec_fuse` installed.\n\n### Pip\n```\npip3 install rockset-stacky\n```\n\n### Manual\n`stacky` requires the following python3 packages installed on the host \n1. asciitree\n2. ansicolors\n3. simple-term-menu\n```\npip3 install asciitree ansicolors simple-term-menu\n```\n\nAfter 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\n\n\n## Accessing Github\nStacky 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/).\n\n## Usage\n`stacky` stores all information locally, within your git repository\nSyntax is as follows:\n- `stacky info`: show all stacks , add\u00a0`-pr`\u00a0if you want to see GitHub PR numbers (slows things down a bit)\n- `stacky branch`: per branch commands (shortcut: `stacky b`)\n - `stacky branch up` (`stacky b u`): move down the stack (towards `master`)\n - `stacky branch down`\u00a0(`stacky b d`): move down the stack (towards\u00a0`master`)\n - `stacky branch new <name>`: create a new branch on top of the current one\n- `stacky commit [-m <message>] [--amend] [--allow-empty]`: wrapper around\u00a0`git commit`\u00a0that syncs everything upstack\n - `stacky amend`: will amend currently tracked changes to top commit\n- Based on the first argument (`stack`\u00a0vs\u00a0`upstack`\u00a0vs\u00a0`downstack`), the following commands operate on the entire current stack, everything upstack from the current PR (inclusive), or everything downstack from the current PR:\n - `stacky stack info [--pr]`\n - `stacky stack sync`: sync (rebase) branches in the stack on top of their parents\n - `stacky stack push [--no-pr]`: push to\u00a0origin, optionally not creating PRs if they don\u2019t exist\n- `stacky upstack onto <target>`: restack the current branch (and everything upstack from it) on top of another branch (like\u00a0`gt us onto`), useful if you\u2019ve made a separate PR that you want to include in your stack\n- `stacky continue`: continue an interrupted\u00a0stacky sync\u00a0command (because of conflicts)\n- `stacky update`: will pull changes from github and update master, and deletes branches that have been merged into master\n\nThe indicators (`*`,\u00a0`~`,\u00a0`!`) mean:\n- `*`\u00a0\u2014 this is the current branch\n- `~`\u00a0\u2014 the branch is not in sync with the remote branch (you should push)\n- `!`\u00a0\u2014 the branch is not in sync with its parent in the stack (you should run\u00a0`stacky stack sync`, which will do some rebases)\n\n```\n$ stacky --help\nusage: stacky [-h] [--color {always,auto,never}]\n {continue,info,commit,amend,branch,b,stack,s,upstack,us,downstack,ds,update,import,adopt,land,push,sync,checkout,co,sco} ...\n\nHandle git stacks\n\npositional arguments:\n {continue,info,commit,amend,branch,b,stack,s,upstack,us,downstack,ds,update,import,adopt,land,push,sync,checkout,co,sco}\n continue Continue previously interrupted command\n info Stack info\n commit Commit\n amend Shortcut for amending last commit\n branch (b) Operations on branches\n stack (s) Operations on the full current stack\n upstack (us) Operations on the current upstack\n downstack (ds) Operations on the current downstack\n update Update repo\n adopt Adopt one branch\n land Land bottom-most PR on current stack\n push Alias for downstack push\n sync Alias for stack sync\n checkout (co) Checkout a branch\n sco Checkout a branch in this stack\n\noptional arguments:\n -h, --help show this help message and exit\n --color {always,auto,never}\n Colorize output and error\n```\n\n### Sample Workflow \n1. Create a new working branch with `stacky branch new <branch_name>`. \n2. Update files and add files to git tracking like normal (`git add`)\n3. Commit updates with `stacky commit -m <commit_message>`\n4. Create a stacked branch with `stacky branch new <downstack_branch_name>`\n5. Update files and add files in downstack branch (`git add`)\n6. `stacky push` will create 2 PRs. Top branch will have a PR against master and bottom branch will have a PR against the top branch.\n7. Update the upstack branch and run `stacky commit`. This will rebase changes in the upstack branch to the downstack branch\n8. `stacky push` will update both the PRs.\n\n```\n$> stacky branch new change_part_1\nbranch 'change_part_1' set up to track 'master'.\n$> touch adding_new_file\n$> git add adding_new_file\n$> stacky commit -m \"Added new file\"\n[change_part_1 23b102a] Added new file\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 adding_new_file\n~* change_part_1\n\u2713 Not syncing branch change_part_1, already synced with parent master\n$> stacky branch new change_part_2\nbranch 'change_part_2' set up to track 'change_part_1'.\n$> touch second_file\n$> git add second_file\n$> stacky commit -m \"Added second file\"\n[change_part_2 0805f57] Added second file\n 1 file changed, 0 insertions(+), 0 deletions(-)\n create mode 100644 second_file\n~* change_part_2\n\u2713 Not syncing branch change_part_2, already synced with parent change_part_1\n$> stacky info\n \u2502 \u250c\u2500\u2500 ~* change_part_2\n \u251c\u2500\u2500 ~ change_part_1\nmaster\n$> stacky push\n \u250c\u2500\u2500 ~* change_part_2\n \u250c\u2500\u2500 ~ change_part_1\nmaster\n\u2713 Not pushing base branch master\n- Will push branch change_part_1 to origin/change_part_1\n- Will create PR for branch change_part_1\n- Will push branch change_part_2 to origin/change_part_2\n- Will create PR for branch change_part_2\n\nProceed? [yes/no] yes\nPushing change_part_1\nCreating PR for change_part_1\n? Title change part 1\n? Body <Received>\n? What's next? Submit as draft\nhttps://github.com/rockset/stacky/pull/2\nPushing change_part_2\nCreating PR for change_part_2\n? Title Added second file\n? Body <Received>\n? What's next? Submit as draft\nhttps://github.com/rockset/stacky/pull/3\n$> git co change_part_1\n$> vim adding_new_file\n$> git add adding_new_file\n$> stacky commit -m \"updated new file\"\n[change_part_1 aa06f71] updated new file\n 1 file changed, 1 insertion(+)\n \u250c\u2500\u2500 !~ change_part_2\n~* change_part_1\n\u2713 Not syncing branch change_part_1, already synced with parent master\n- Will sync branch change_part_2 on top of change_part_1\n```\n\n## Tuning\n\nThe behavior of `stacky` allow some tuning. You can tune it by creating a `.stackyconfig`\nthe file has to be either at the top of your repository (ie. next to the `.git` folder) or in the `$HOME` folder.\n\nIf both files exists the one in the home folder takes precedence.\nThe format of that file is following the `ini` format and has the same structure as the `.gitconfig` file.\n\nIn the file you have sections and each sections define some parameters.\n\nWe currently have the following sections:\n * UI\n\nList of parameters for each sections:\n\n### UI\n * skip_confirm, boolean with a default value of `False`, set it to `True` to skip confirmation before doing things like reparenting or removing merged branches.\n * 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.\n * change_to_adopted: boolean with a default value of `False`, when set to `True` `stacky` will change the current branch to the adopted one.\n * 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.\n\n## License\n- [MIT License](https://github.com/rockset/stacky/blob/master/LICENSE.txt)\n",
"bugtrack_url": null,
"license": "",
"summary": "stacky is a tool to manage stacks of PRs. This allows developers to easily",
"version": "1.0.13",
"project_urls": {
"Bug Reports": "https://github.com/rockset/stacky/issues",
"Homepage": "https://github.com/rockset/stacky",
"Source": "https://github.com/rockset/stacky"
},
"split_keywords": [
"github",
"stack",
"pr",
"pull request"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "429f73d1f71f59bdc1f7e3dc497d7b9b562967694b41ff0579f1909c29ff3f8a",
"md5": "18a40ca6c65bed259a7d201194009b64",
"sha256": "088fc9fa3c6e47aed2c5c5866ec8157e40e8ce0f67e51c6a95ffeb30cc9fe68e"
},
"downloads": -1,
"filename": "rockset_stacky-1.0.13-py3-none-any.whl",
"has_sig": false,
"md5_digest": "18a40ca6c65bed259a7d201194009b64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8, <4",
"size": 20055,
"upload_time": "2024-02-11T00:37:01",
"upload_time_iso_8601": "2024-02-11T00:37:01.469366Z",
"url": "https://files.pythonhosted.org/packages/42/9f/73d1f71f59bdc1f7e3dc497d7b9b562967694b41ff0579f1909c29ff3f8a/rockset_stacky-1.0.13-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "de5a3426af93cc1da1b7c8587bf1d7c12533d25a3702ec88eeb2a330b1a08efe",
"md5": "350fc2f737ce7006012287386eb02c84",
"sha256": "6fbbc353f5557fbb59d45b0318f32707db8aa53cbaa255fe9928b5547404e410"
},
"downloads": -1,
"filename": "rockset-stacky-1.0.13.tar.gz",
"has_sig": false,
"md5_digest": "350fc2f737ce7006012287386eb02c84",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8, <4",
"size": 19757,
"upload_time": "2024-02-11T00:37:02",
"upload_time_iso_8601": "2024-02-11T00:37:02.694852Z",
"url": "https://files.pythonhosted.org/packages/de/5a/3426af93cc1da1b7c8587bf1d7c12533d25a3702ec88eeb2a330b1a08efe/rockset-stacky-1.0.13.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-11 00:37:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rockset",
"github_project": "stacky",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "rockset-stacky"
}