Skip to content

Commit

Permalink
Note how to update contributors' branches (#879)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbaldry authored Oct 17, 2024
1 parent f5b8154 commit 9a7edd2
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions docs/sources/write/tooling-and-workflows/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,32 +370,21 @@ From the point where you created your branch and when you're ready to merge the

If the changes don't conflict, you can use Git to incorporate the changes made to the default branch with yours without making any additional changes.

First, fetch changes to all branches and remotes:
{{< admonition type="tip" >}}
You can also update a contributors' branch as long as the pull request shows **Maintainers are allowed to edit this pull request.**

```bash
git fetch --all
```
To do so, first check out their pull request with either [Check out a PR branch](https://grafana.com/docs/writers-toolkit/write/tooling-and-workflows/#check-out-a-pr-branch) or [Check out a PR branch from a fork](https://grafana.com/docs/writers-toolkit/write/tooling-and-workflows/#check-out-a-pr-branch-from-a-fork).
{{< /admonition >}}

Update your local copy of the main branch by merging the remote changes into it:
First, fetch changes to all branches and remotes:

```bash
git switch main
git merge --ff-only
```

After switching branches, Git also lets you know if your local copy needs updating with the message _Your branch is behind 'origin/main'_.
The `--ff-only` flag means _fast-forwarding_, which applies the changes to the end of your local copy when your local copy has no conflicting changes.

```console
Switched to branch 'main'
Your branch is behind 'origin/main' by 30 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
git fetch --all
```

Now switch back to your branch and merge the default branch into it, applying its changes into yours:
On your branch, merge the default branch, applying its changes into yours:

```bash
git switch my-branch
git merge main
```

Expand Down

0 comments on commit 9a7edd2

Please sign in to comment.