Skip to content

Commit a3abc84

Browse files
committed
Update README
1 parent b3c7fe4 commit a3abc84

File tree

3 files changed

+179
-14
lines changed

3 files changed

+179
-14
lines changed

README.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ One idempotent command to rule 'em all:
99
git grok
1010
```
1111

12-
No arguments. No configuration. No interactivity. On intent.
12+
No arguments. No configuration. No interactivity.
13+
14+
You don't need to learn a separate Git UI: continue running Git in console if
15+
you want, or use your favorite tools (like VSCode's Git panel).
16+
17+
## Stacked PRs
1318

1419
If you frequently write code and find it tedious to manage interdependent
1520
branches (like when "branch A depends on branch B which itself depends on branch
@@ -18,15 +23,23 @@ known as "stacked PRs", is used in Meta, Google and other leading companies.
1823

1924
The central idea is that every individual commit in your local working copy
2025
becomes an individual pull request. Commits can be stacked on top of each other,
21-
reordered, and edited right on your computer using the standard `git` features.
26+
reordered, and edited right on your computer using the standard Git features.
2227
Then, run `git-grok` to sync the changes in local commits out to their
23-
corresponding PRs.
28+
corresponding PRs at GitHub.
2429

25-
When you want to make changes based on feedback in some PR, just go to the local
26-
commit in your stack, make the change ("edit a commit in the middle of the
30+
When you want to make changes based on feedback in some PR, just "jump into" the
31+
local commit in your stack, make the change ("edit a commit in the middle of the
2732
stack"), and rerun `git grok` to get it propagated to the PRs at GitHub.
2833

29-
<img src="media/he-grokked.jpg" />
34+
Want to reorder the commits to merge the approved one before another? Do it
35+
locally and run `git grok`.
36+
37+
<img src="media/he-grokked.jpg" width="500" />
38+
39+
The guy above hints that stacked PRs workflow is incredibly sticky, although it
40+
has some learning curve. (It's not the workflow that has the curve, but Git
41+
itself.) Try using `git-grok` for a week, and you'll never get back. This is a
42+
one way road.
3043

3144
## Installation
3245

@@ -45,20 +58,18 @@ gh auth login
4558

4659
```bash
4760
cd your-repository
48-
git pull --rebase
61+
git pull
4962

5063
# Create a PR from the topmost commit you've just made.
5164
touch commit1
52-
git add . && git commit -m "your commit message here"
65+
git add . && git commit -m "Some commit"
5366
git grok
5467

5568
# Create more commits on top of each other, all on top of main.
5669
touch commit2
57-
git add . && git commit -m "your commit message here"
70+
git add . && git commit -m "Add more examples to README"
5871
touch commit3
59-
git add . && git commit -m "your commit message here"
60-
touch commit4
61-
git add . && git commit -m "your commit message here"
72+
git add . && git commit -m "Add a screenshot of git-grok run"
6273

6374
# This turns each individual commit on top of main into individual PRs
6475
# (one commit = one PR) and keeps the PRs in sync with local commits.
@@ -107,8 +118,8 @@ PR in the stack by clicking the button in GitHub UI (it will go to the main
107118
branch).
108119

109120
Then, after the PR is merged, GitHub is smart enough to update the base of the
110-
next PR in the stack to point to the main branch (hooray!). So you just switch
111-
to the 2nd PR in the stack and merge it.
121+
next PR in the stack to point to the main branch (hooray!). So you just click on
122+
the 2nd PR in the stack and merge it.
112123

113124
Rinse.
114125

@@ -119,6 +130,25 @@ UI. GitHub is smart, so it automatically changes the base of the next PR to main
119130
once its old branch is auto-deleted when you merge, but if you see something
120131
unusual, just rerun `git pull --rebase && git grok`
121132

133+
## Most Magic is Provided by GitHub and Git...
134+
135+
To demystify `git-grok`, it's worth pointing out a list of things that it does
136+
**not** do:
137+
138+
1. It does not create commits.
139+
2. It does not modify commits code nor anyhow change the Git tree.
140+
3. It does not merge pull requests. Does not close PRs.
141+
4. It does not pull.
142+
5. It does not produce merge conflicts.
143+
6. It does not add reviewers to the PRs.
144+
7. It does not modify PR title and description.
145+
146+
All of the above is done by either Git or GitHub.
147+
148+
**What `git-grok` does:** is continuously ensures that each 1 existing local
149+
commit has 1 corresponding and up-to-date PR on GitHub. In that direction. Not
150+
more, not less.
151+
122152
## What if my GitHub Actions are slow, so they take minutes to execute?
123153

124154
(First of all, you'd better make them fast, because you're wasting the

media/logo.png

39.9 KB
Loading

0 commit comments

Comments
 (0)