Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
update CLI merge instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyan committed Feb 21, 2022
1 parent 2b27317 commit 42c1162
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
16 changes: 0 additions & 16 deletions guides/graphite-cli/landing-a-stack.md

This file was deleted.

20 changes: 20 additions & 0 deletions guides/graphite-cli/merging-a-stack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Merging a stack

{% hint style="warning" %}
We find that merging with the Graphite UI saves our engineers - and the engineers that have used it - a substantial amount of time by automating the process of waiting for CI, merging, and rebasing. Anecdotally, we've a number of stories from our users about how they used to block out "half days" just to merge their stacks before using the Graphite UI.

As a result, we strongly recommend merging via the Graphite UI over merging via just the CLI.

If you haven't yet tried it, check out the instructions [here](https://docs.graphite.dev/guides/graphite-dashboard/merging-your-pull-requests#merging-a-stack-of-prs).
{% endhint %}

To merge a stack using the Graphite CLI:

1. Merge the PR at the bottom of the stack into `main` on the [**Graphite dashboard**](https://app.graphite.dev) (or via GitHub).
2. Run `gt repo sync`.
3. Checkout the next PR in your stack (`gt branch next`) and run `gt stack submit` to force push the rebased branch.
4. Repeat until you've landed all of the branches in your stack.

{% hint style="success" %}
Congratulations - you've landed your stack! Check out the rest of the CLI guide for power user features and to learn about the Graphite dashboard.
{% endhint %}
10 changes: 3 additions & 7 deletions guides/graphite-dashboard/merging-your-pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,11 @@ If you're not sure whether `Merge all (n)` will work with your team's merge proc

We find that merging with the Graphite UI saves our engineers - and the engineers that have used it - a substantial amount of time. Anecdotally, we've a number of stories from our users about how they used to block out "half days" just to merge their stacks before using the Graphite UI.

However, if you'd like to manually usher your PRs out the door, we recommend always merging from the bottom of the stack; while there are other techniques, we've found that this is the most intuitive and safe model for our users.
However, if you'd like to manually usher your PRs out the door, you can find a set of instructions on how to merge a stack using our Graphite CLI [here](https://docs.graphite.dev/guides/graphite-cli/landing-a-stack).

To merge from the bottom of the stack:
* Merge the bottom-most PR in the stack.
* Run `gt repo sync` locally to rebase the upstack PRs, automatically slicing off the already-merged commits to avoid GitHub merge conflicts.
* Run `gt stack submit` to re-submit the rebased PRs.
* After CI has finished running, repeat the process with the new stack base.
{% hint style="warning" %}
Note that we recommend always merging from the bottom of the stack; while there are other techniques, we've found that this is the most intuitive and safe model for our users.

{% hint style="info %}
Merging in reverse order from the middle or top of the stack, collapsing all of the PRs into one, is the fastest way to merge an entire stack, but in our experience, there are a number of pitfalls for users - namely around syncing this merged state locally (to continue developing on any upstack PRs) or undoing these changes if a user decides not to merge a PR - that can lead to perilous situations where users have felt like they've lost code or can't re-create their previous state.

While certainly not impossible, it's also harder to re-derive the original stack of PRs when looking at the git history.
Expand Down

0 comments on commit 42c1162

Please sign in to comment.