Skip to content

Commit

Permalink
Docs: Updating the Git Workflow docs to explain how to update an exte…
Browse files Browse the repository at this point in the history
…rnal contributors PR (#37853)

* Updating the Git Workflow docs to explain how to update an external contributors PR

* Modifying the suggested steps to use the GH CLI

* Typo fix

* Add missing dash in git push --force

* Update docs/git-workflow.md

Co-authored-by: Jeremy Herve <[email protected]>

---------

Co-authored-by: Jeremy Herve <[email protected]>
  • Loading branch information
coder-karen and jeherve authored Jun 14, 2024
1 parent c20dbcc commit 18bd944
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions docs/git-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ $ git rebase jetpack/trunk
$ git push -f origin update/my-changes
```

### Updating an external contributor's PR

If you're working directly with Jetpack trunk and need to update an external contributor's PR, the below commands will be helpful.
This method assumes you are using the `gh` shorthand from the [Github CLI](https://cli.github.com/):

```sh
# Use the Github CLI to checkout the PR with the PR number - for example gh pr checkout 12345.
gh pr checkout xxxxx

# Run merge-base to check where that branch differed from trunk - example git merge-base update/broken-jetpack-feature trunk.
git merge-base forkedbranchname trunk

## With the SHA returned from the above command, we can rebase from that.
git rebase -i the-sha

## Rebase the current branch onto origin/trunk.
git rebase origin/trunk

## Push the updated branch to the forked branch. Note that using --force-with-lease won't work due to an existing GitHub CLI issue, but --force will)
git push --force
```

### Tips for common issues when merging

#### Dealing with lock files
Expand Down

0 comments on commit 18bd944

Please sign in to comment.