Syncing your branch

As commits are pushed to your project on GitHub, you can keep your local copy of the project in sync with the remote repository.

You must sync your local branch with the remote repository to get any additional commits that have been added to the upstream branch since you originally created your branch.

In this article:

Update your local branch

  1. In GitHub Desktop, switch to the local branch you want to update by clicking Current Branch and selecting the branch from the list.
  2. Click Fetch origin to update your branch.
    The Fetch origin button
  3. If there are commits on the remote branch, you can pull these by clicking Pull origin.
    The Pull origin button

Merge another branch into your project branch

  1. At the top of the app, click Current Branch.

    Current Branch drop-down menu

  2. Click Choose a branch to merge into BRANCH.

    Choose a branch option in the list of branches menu

  3. Click the branch you want to merge into the current branch, then click Merge BRANCH into BRANCH.

Note: If there are merge conflicts, GitHub Desktop will warn you above the Merge BRANCH into BRANCH button. You will not be able to merge the branches until you have resolved all conflicts. For more information, see "Resolving a merge conflict."

The Merge button 1. Click Push origin to push your changes to the remote. The Push button

Resolving a merge conflict

GitHub Desktop supports different workflows for resolving merge conflicts. You can navigate away from GitHub Desktop at any time to your preferred tool for resloving merge conflicts and GitHub Desktop will detect the changes you made.

  1. At the top of the app, click Current Branch.

    Current Branch drop-down menu

  2. Click Choose a branch to merge into BRANCH.

    Choose a branch option in the list of branches menu

  3. Click the branch you want to merge into the current branch, then click Merge BRANCH into BRANCH.

    The Merge button with a merge conflict warning

  4. Resolve the merge conflict in your preferred way, using a text editor, the command line, or another tool.

    • To open a single file with a conflict in your default text editor, next to the file name, click Open in EDITOR.
    • To open the repository in the command line, click Open in command line.
      Options to resolve merge conflicts

    Tips:

    • To close the merge conflict options window at any time, in the top right corner, click the . To re-open the merge conflict window, above the "Changes" tab, click View conflicts.

    • For more information about using the command line, see "Resolving a merge conflict using the command line."

  5. Click Commit merge.

    Commit merge after conflicts are resolved option

  6. Click Push origin to push your changes to the remote.

    The Push button

Ask a human

Can't find what you're looking for?

Contact us