Skip to content

Commit d12b970

Browse files
docs: add rationale for using merge over rebase
PR-URL: #6444 Reviewed-by: Athan Reines <[email protected]>
1 parent eab670a commit d12b970

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/contributing/git_cheatsheet.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -452,28 +452,29 @@ Assuming you've already cloned the repository and set up your identity:
452452
453453
```bash
454454
$ git checkout develop
455-
$ git pull --ff-only upstream develop # Update local develop first
455+
$ git pull upstream develop # Update local develop first
456+
$ git push origin develop
456457
$ git checkout feature/is-even
457-
$ git rebase develop # or git merge develop
458+
$ git merge develop
458459
```
459460
460-
Resolve any conflicts with the steps mentioned earlier, then continue the rebase:
461+
Resolve any conflicts with the steps mentioned earlier, then continue the merge:
461462
462463
<!-- run-disable -->
463464
464465
```bash
465-
$ git rebase --continue
466+
$ git merge --continue
466467
```
467468
468469
Finally, push your changes:
469470
470471
<!-- run-disable -->
471472
472473
```bash
473-
$ git push --force # Force push after rebasing
474+
$ git push origin feature/is-even
474475
```
475476
476-
> **Note:** Force pushing is required after rebasing because it rewrites history. This is safe as long as you're the only one working on the branch. If you want to avoid force pushing, use merge instead of rebase.
477+
> **Note:** When developing stdlib, we recommend using `merge` instead of `rebase` once a PR is open. Rebasing rewrites your branch history, which usually requires a force-push to update the remote branch. This can disrupt other contributors who are reviewing or collaborating on your PR. Since stdlib uses squash and merge for PRs, we don't require a clean, linear commit history. Merge commits are acceptable as long as your diff only contains relevant changes.
477478
478479
8. **Repeat**: After resolving conflicts and updating your branch, you can continue making changes, committing, and pushing until your PR is ready to be merged.
479480

0 commit comments

Comments
 (0)