You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -13,16 +13,17 @@ versions:
13
13
ghec: '*'
14
14
topics:
15
15
- Pull requests
16
+
permissions: People with write access for a forked repository can sync the fork to the upstream repository.
16
17
---
17
18
18
19
{% ifversion fpt or ghes > 3.1 or ghae or ghec %}
19
20
20
21
## Syncing a fork from the web UI
21
22
22
23
1. On {% data variables.product.product_name %}, navigate to the main page of the forked repository that you want to sync with the upstream repository.
1. Review the details about the commits from the upstream repository, then click **Fetch and merge**.
26
+
3. Review the details about the commits from the upstream repository, then click **Fetch and merge**.
26
27

27
28
28
29
If the changes from the upstream repository cause conflicts, {% data variables.product.company_short %} will prompt you to create a pull request to resolve the conflicts.
@@ -35,6 +36,7 @@ Before you can sync your fork with an upstream repository, you must [configure a
35
36
{% data reusables.command_line.open_the_multi_os_terminal %}
36
37
2. Change the current working directory to your local project.
37
38
3. Fetch the branches and their respective commits from the upstream repository. Commits to `BRANCHNAME` will be stored in the local branch `upstream/BRANCHNAME`.
39
+
38
40
```shell
39
41
$ git fetch upstream
40
42
> remote: Counting objects: 75, done.
@@ -44,12 +46,16 @@ Before you can sync your fork with an upstream repository, you must [configure a
44
46
> From https://{% data variables.command_line.codeblock %}/<em>ORIGINAL_OWNER</em>/<em>ORIGINAL_REPOSITORY</em>
45
47
>* [new branch] main -> upstream/main
46
48
```
49
+
47
50
4. Check out your fork's local default branch - in this case, we use `main`.
51
+
48
52
```shell
49
53
$ git checkout main
50
54
> Switched to branch 'main'
51
55
```
56
+
52
57
5. Merge the changes from the upstream default branch - in this case, `upstream/main` - into your local default branch. This brings your fork's default branch into sync with the upstream repository, without losing your local changes.
0 commit comments