Skip to content

Commit d8e2996

Browse files
committed
docs: Update for new commands
This reflects #257
1 parent 86c8312 commit d8e2996

File tree

2 files changed

+88
-16
lines changed

2 files changed

+88
-16
lines changed

README.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,13 @@ undoing `git stack` operations:
102102
$ cargo install git-branch-stash-cli
103103
```
104104

105-
### Uninstall
106-
107-
See the uninstall method for your installer.
108-
109-
Once removed, `git-stack` leaves behind:
110-
- `.git/branch-stash`
111-
112-
Removing this is safe and will have no effect.
113-
114-
## Getting Started
115-
116105
### Configuring `git-stack`
117106

107+
**Aliases:** To avoid name collisions while keeping things brief, `git-stack`
108+
ships as one binary but can help configure aliases by running `git
109+
stack alias --register`. You can then modify the aliases if you want to make
110+
some flags the default.
111+
118112
**Protected branches:** These are branches that `git-stack` should not modify.
119113
`git-stack` will also rebase local protected branches against
120114
their remote counter parts. Usually you mark shared or long-lived branches as
@@ -132,24 +126,40 @@ To see the config, run `git-stack --dump-config -`.
132126

133127
For more, see [Configuration Reference](docs/reference.md#configuration).
134128

129+
### Uninstall
130+
131+
If you registered aliases, you'll want to run `git stack alias --unregister` to remove them.
132+
133+
See the uninstall method for your installer.
134+
135+
Once removed, `git-stack` leaves behind:
136+
- `.git/branch-stash`
137+
138+
Removing this is safe and will have no effect.
139+
140+
## Getting Started
141+
135142
### Using
136143

137144
```console
138145
$ # Update branches against upstream
139-
$ git stack --pull
146+
$ git sync
140147

141148
$ # Start a new branch / PR
142149
$ git switch -c feature1
143150
$ git add -A; git commit -m "Work"
144151
$ git add -A; git commit -m "More Work"
145-
$ git add -A; git commit --fixup HEAD~~
152+
$ git run cargo check
153+
$ git prev
154+
$ git add -A; git amend # Fix problems in "Work" commit
155+
$ git run cargo check
156+
$ git next
146157

147158
$ # See what this looks like
148159
$ git stack
149160

150161
$ # Clean up in preparation for a push
151-
$ git stack --pull
152-
$ git stack --fixup squash
162+
$ git sync
153163

154164
$ # Push whats ready
155165
$ git stack --push

docs/reference.md

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ This may be the same as the `pull-remote` when working directly in the upstream
2929

3030
## Commands
3131

32+
### `git stack alias`
33+
34+
View, register, and unregister `git stack` specific aliases.
35+
36+
Use case: keep commands short while avoiding name conflicts with existing aliases or other installed commands.
37+
3238
### `git stack`
3339

3440
Visualizes the branch stacks on top of their protected bases.
@@ -39,7 +45,8 @@ Why not `git log --graph --all --oneline --decorate main..HEAD`?
3945
- Have to manually select your base to limit to relevant commits
4046
- Slower because it loads the entire commit graph into memory to sort it
4147

42-
### `git stack --pull`
48+
### `git sync`
49+
*i.e. `git stack sync`*
4350

4451
Pulls your protected branches from the `stack.pull-remote` and then rebases
4552
your development branches on top of their relevant protected branches.
@@ -49,6 +56,8 @@ Unlike `--rebase`, this does not perform any "auto" operations.
4956
Note:
5057
- This also performs a fetch of your `stack.push-remote` to prune any removed remotes
5158

59+
Use case: detect merge and semantic conflicts early
60+
5261
Why not `git pull --rebase upstream main`?
5362
- Have to manually select your remote/branch
5463
- Only updates current branch
@@ -58,6 +67,59 @@ Why not `git pull --rebase upstream main`?
5867
- Have to manually delete merged branches
5968
- Only fetches from `upstream`, leaving your deleted `origin` branches lingering locally
6069

70+
### `git next`
71+
*i.e. `git stack next`*
72+
73+
Switch to a child commit.
74+
75+
Use case: easily navigate to edit commits with commands like `git amend`.
76+
77+
Why not `git stack && git checkout <ref>`?
78+
- Saves you from having to type or copy/paste `<ref>`
79+
80+
### `git prev`
81+
*i.e. `git stack prev`*
82+
83+
Switch to a parent commit.
84+
85+
Use case: easily navigate to edit commits with commands like `git amend`.
86+
87+
Why not `git stack && git checkout <ref>`?
88+
- Saves you from having to type or copy/paste `<ref>`
89+
90+
### `git reword`
91+
*i.e. `git stack reword`*
92+
93+
Edit the current commit's message.
94+
95+
Use case: easily edit parent commits.
96+
97+
Why not `git commit --amend`?
98+
- Automatically rebases all children commits / branches
99+
- Avoid accidentally editing a protected commit or a commit with fixups referencing it
100+
101+
Why not `git rebase -i <ref>` and setting it the action to `r`?
102+
- Fewer steps (no need to choose ref, go to correct line and edit it to then edit the message)
103+
- Automatically rebases all children commits / branches
104+
105+
### `git amend`
106+
*i.e. `git stack amend`*
107+
108+
Squash staged changes into the current commit.
109+
110+
Use case: easily edit parent commits.
111+
112+
Why not `git commit --amend --no-edit`?
113+
- Automatically rebases all children commits / branches
114+
- Avoid accidentally editing a protected commit or a commit with fixups referencing it
115+
116+
### `git run`
117+
*i.e. `git stack run`*
118+
119+
Run a command across the current stack of commits.
120+
121+
Use case: verify your commits still build after editing history.
122+
61123
### `git stack --rebase`
62124

63125
Rebase development branches on their relevant protected branches.

0 commit comments

Comments
 (0)