From d8b6f17adad0e0d5d25ba727e9bc135f71bc42f9 Mon Sep 17 00:00:00 2001 From: Ritesh Patil Date: Mon, 14 Feb 2022 16:37:47 +0000 Subject: [PATCH 1/2] fix: add a note clarifying the required permissions for syncing a fork --- .../working-with-forks/syncing-a-fork.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md b/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md index 586100d514..c9455c7b86 100644 --- a/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md +++ b/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md @@ -19,6 +19,12 @@ topics: ## Syncing a fork from the web UI +{% note %} + +**Note**: You can only sync a fork if you have write permissions + +{% endnote %} + 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. Select the **Fetch upstream** drop-down. !["Fetch upstream" drop-down](/assets/images/help/repository/fetch-upstream-drop-down.png) @@ -35,6 +41,7 @@ Before you can sync your fork with an upstream repository, you must [configure a {% data reusables.command_line.open_the_multi_os_terminal %} 2. Change the current working directory to your local project. 3. Fetch the branches and their respective commits from the upstream repository. Commits to `BRANCHNAME` will be stored in the local branch `upstream/BRANCHNAME`. + ```shell $ git fetch upstream > remote: Counting objects: 75, done. @@ -44,12 +51,16 @@ Before you can sync your fork with an upstream repository, you must [configure a > From https://{% data variables.command_line.codeblock %}/ORIGINAL_OWNER/ORIGINAL_REPOSITORY > * [new branch] main -> upstream/main ``` + 4. Check out your fork's local default branch - in this case, we use `main`. + ```shell $ git checkout main > Switched to branch 'main' ``` + 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. + ```shell $ git merge upstream/main > Updating a422352..5fdff0f From bc542072fbec17a6d67155746b7fcb2ff6f069db Mon Sep 17 00:00:00 2001 From: Ritesh Patil Date: Tue, 1 Mar 2022 10:13:29 +0000 Subject: [PATCH 2/2] fix: remove permission note and shift to permissions frontmatter --- .../working-with-forks/syncing-a-fork.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md b/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md index c9455c7b86..ea4610c2fc 100644 --- a/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md +++ b/content/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.md @@ -13,22 +13,17 @@ versions: ghec: '*' topics: - Pull requests +permissions: People with write access for a forked repository can sync the fork to the upstream repository. --- {% ifversion fpt or ghes > 3.1 or ghae or ghec %} ## Syncing a fork from the web UI -{% note %} - -**Note**: You can only sync a fork if you have write permissions - -{% endnote %} - 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. Select the **Fetch upstream** drop-down. +2. Select the **Fetch upstream** drop-down. !["Fetch upstream" drop-down](/assets/images/help/repository/fetch-upstream-drop-down.png) -1. Review the details about the commits from the upstream repository, then click **Fetch and merge**. +3. Review the details about the commits from the upstream repository, then click **Fetch and merge**. !["Fetch and merge" button](/assets/images/help/repository/fetch-and-merge-button.png) 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.