Skip to content

Commit ea8508e

Browse files
committed
update readme
1 parent a9b62c5 commit ea8508e

File tree

3 files changed

+62
-74
lines changed

3 files changed

+62
-74
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
22
name = "git-stack"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
edition = "2024"
55
license = "GPL2"
6-
keywords = ["git", "stack", "vcs"]
6+
keywords = ["git", "stack", "github"]
77
categories = ["development-tools"]
88
description = "A git stacking CLI for basic stacked diff management."
99
readme = "README.md"

README.md

Lines changed: 59 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,107 @@
11
# git-stack
22

3-
`git-stack` is a command-line tool for managing stacked git branches — a workflow where you develop
4-
features atop one another, keeping their history clean and rebasing as needed. It tracks
5-
relationships between branches, helps you re-stack and synchronize them, and visualizes your stack
6-
tree.
7-
8-
`git-stack` also allows for synchronization between Github and local state.
9-
10-
## Key Features
11-
12-
- Stacked Workflow: Track parent-child branch relationships ("stacks") in your repo.
13-
- Restack: Automatically rebase your branch stack on top of trunk or another branch.
14-
- Status Tree: Visualize your current stacked branches, their hierarchy, and sync status.
15-
- Branch Mounting: Change the parent branch of an existing branch in your stack.
16-
- Diffs: Show changes between a branch and its parent.
17-
- Safe Operations: Prevent accidental data loss by checking upstream sync status.
3+
A command-line tool for managing stacked git branches. Develop features on top of one another, keep history clean, and sync with GitHub.
184

195
## Installation
206

21-
Build from source (Rust required):
22-
237
```bash
24-
cargo install --path .
8+
cargo install --git https://github.com/wbbradley/git-stack --locked
259
```
2610

27-
This will install a CLI you can use as follows:
11+
## Quick Start
2812

2913
```bash
30-
git stack <command> [options]
14+
git stack # show your stack
15+
git stack sync # sync local state with GitHub (push + pull)
16+
git stack checkout feature # create branch "feature" as child of current branch
17+
# ...make changes, commit...
18+
git stack restack # restack the current branch onto its parent
19+
git stack diff # diff against parent branch
20+
git stack pr create # create GitHub PR with correct base branch
3121
```
3222

33-
## Usage
23+
## Commands
3424

35-
You can invoke `git-stack` directly or as a git subcommand:
25+
### View Your Stack
3626

3727
```bash
38-
git stack <subcommand> [options]
28+
git stack # show the stack tree (alias: git stack status)
3929
```
4030

41-
### Common Subcommands
42-
43-
- `status`: Show the current stack tree in the repo.
44-
- _Default_, so `git stack` is equivalent to `git stack status`.
45-
46-
- `checkout <branch>`: Create a new branch stacked on the current branch, or checkout an existing
47-
one in the stack.
48-
49-
- `restack [--branch <branch>]`: Rebase the named (or current) branch and its descendents onto their
50-
updated stack base (like trunk or a parent feature branch). This command recursively applies to
51-
all ancestors of the given branch.
31+
### Create Branches
5232

53-
- `mount [<parent-branch>]`: Mounts (attaches) the current branch on a different parent branch.
33+
```bash
34+
git stack checkout feature # create "feature" stacked on current branch
35+
```
5436

55-
- `diff [<branch>]`: Show diff between a branch and its stack parent.
37+
### Restack Branches
5638

57-
- `delete <branch>`: Remove a branch from the stack tree.
39+
```bash
40+
git stack restack # restack current branch onto its parent
41+
git stack restack -afp # fetch, recursively restack from trunk, push on success
42+
```
5843

59-
### Examples
44+
The `-afp` flags:
45+
- `-a` / `--ancestors`: recursively restack all ancestors from trunk up to current branch
46+
- `-f` / `--fetch`: fetch updates from remote first
47+
- `-p` / `--push`: push branch updates to remote on success
6048

61-
#### See your stack status
49+
### Diff Against Parent
6250

63-
```
64-
git stack status
51+
```bash
52+
git stack diff # diff against parent branch
6553
```
6654

67-
#### Create and stack a new branch
55+
### Create Pull Requests
6856

69-
```
70-
git stack checkout my-feature
57+
```bash
58+
git stack pr create # create GitHub PR with correct base branch
7159
```
7260

73-
#### Restack your current branch
61+
### Change Parent Branch
7462

75-
```
76-
git stack restack
63+
```bash
64+
git stack mount <parent> # stack current branch on a different parent
7765
```
7866

79-
#### Change the parent stack of a feature branch
67+
This only updates git-stack metadata, not git history. Use `restack` afterward to keep this branch
68+
in sync with its parent.
8069

81-
```
82-
git stack mount new-parent-branch
70+
### Delete Branches
71+
72+
```bash
73+
git stack delete <branch> # remove a branch from the stack
8374
```
8475

85-
#### Show diff with parent
76+
Note that `git stack sync` will automatically prune local branches that are duplicates of the remote
77+
branch, or have already been merged.
8678

87-
```
88-
git stack diff my-feature
89-
```
79+
## Workflow Example
9080

91-
#### Remove a branch from stack management
81+
```bash
82+
# Start on main
83+
git stack checkout auth # create auth branch
84+
# ...implement auth, commit...
9285

93-
```
94-
git stack delete my-feature
86+
git stack checkout login # create login branch (child of auth)
87+
# ...implement login, commit...
88+
89+
git stack # see your stack tree
90+
git stack restack -afp # sync everything and push
91+
git stack pr create # create PR for current branch
9592
```
9693

9794
## Stack Storage
9895

99-
- Stack state is stored per-repo in a YAML file at:
100-
`~/.local/state/git-stack/state.yaml` (using XDG state dir conventions).
101-
102-
## Requirements
103-
104-
- A POSIX shell
105-
- git (on your `$PATH`)
106-
- Rust (to install/build)
96+
Stack state is stored per-repo in `~/.local/state/git-stack/state.yaml`.
10797

10898
## Troubleshooting
10999

110-
If `git stack` reports missing branches or refuses to restack:
100+
If `git stack` reports issues:
111101

112-
- Ensure your working tree is clean (`git status`).
113-
- Use standard git commands to resolve any rebase conflicts (`git mergetool` is your friend,
114-
followed by `git rebase --continue`), then rerun `git stack restack`.
115-
- Note that the last-known-good location of the parent branch is stored in the sub-branch in order
116-
to allow for cleaner movement of branches
102+
- Ensure your working tree is clean (`git status`)
103+
- Resolve rebase conflicts with standard git commands (`git mergetool`, then `git rebase --continue`)
104+
- Rerun `git stack restack` after resolving conflicts
117105

118106
## License
119107

0 commit comments

Comments
 (0)