Skip to content

Commit 66e97aa

Browse files
authored
[llvm][docs] Add information about using GitHub's UI for updating a branch (#166625)
GitHub's Update Branch button is a helpful tool for quickly updating a PR before merging, but it might also be important to point out that it creates a merge commit without additional prompting, which may or may not be desired behavior for a given LLVM contributor. Opened on the suggestion of @lamb-j
1 parent db5b398 commit 66e97aa

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

llvm/docs/GitHub.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,20 @@ Updating Pull Requests
8282
----------------------
8383
In order to update your pull request, the only thing you need to do is to push
8484
your new commits to the branch in your fork. That will automatically update
85-
the pull request.
85+
the pull request. You can also use the Update Branch button in GitHub's Pull
86+
Request UI, but be aware that it will create a merge commit on your branch.
8687

8788
When updating a pull request, you should push additional "fix up" commits to
8889
your branch instead of force pushing. This makes it easier for GitHub to
8990
track the context of previous review comments. Consider using the
9091
`built-in support for fixups <https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---fixupamendrewordltcommitgt>`_
9192
in git.
9293

93-
If you do this, you must squash and merge before landing the PR and
94-
you must use the pull request title and description as the commit message.
95-
You can do this manually with an interactive git rebase or with GitHub's
96-
built-in tool. See the section about landing your fix below.
94+
If you create fix up or merge commits, you must squash and merge before
95+
landing the PR and you must use the pull request title and description as
96+
the commit message. You can do this manually with an interactive git
97+
rebase or with GitHub's built-in tool. See the section about landing your
98+
fix below.
9799

98100
When pushing to your branch, make sure you push to the correct fork. Check your
99101
remotes with:
@@ -108,7 +110,9 @@ Rebasing Pull Requests and Force Pushes
108110
---------------------------------------
109111
In general, you should avoid rebasing a Pull Request and force pushing to the
110112
branch that's the root of the Pull Request during the review. This action will
111-
make the context of the old changes and comments harder to find and read.
113+
make the context of the old changes and comments harder to find and read. If
114+
you want to make your pull request up-to-date with main, you might consider
115+
updating your branch, as described in the previous section.
112116

113117
Sometimes, a rebase might be needed to update your branch with a fix for a test
114118
or in some dependent code.

0 commit comments

Comments
 (0)