GitHub Desktop Contributing to projects Working with your remote repository on GitHub or GitHub Enterprise

https://help.github.com/en/desktop/contributing-to-projects/syncing-your-branch

 

 

 

 

GitHub Desktop Contributing to projects Working with your remote repository on GitHub or GitHub Enterprise Syncing your branch

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.

In this article

  • Update your local branch
  • Merge another branch into your project branch
  • Rebase your project branch onto another branch

Were you able to find what you were looking for?

Top of Form

  •  Yes, easily
  •  Yes, eventually
  •  No

 Send

Bottom of Form

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.

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.

 

  1. If there are commits on the remote branch, you can pull these by clicking Pull origin or Pull origin with rebase.

 

  1. Resolve any merge conflicts in your preferred way, using a text editor, the command line, or another tool.

Merge another branch into your project branch

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

 

  1. Click Choose a branch to merge into BRANCH.

 

  1. 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.

 

  1. Click  Push origin or Force push origin to push your changes to the remote.

 

Rebase your project branch onto another branch

Some workflows either require or benefit from rebasing as opposed to merging. By rebasing you can reorder, edit, or squash commits together. For more information, see "About Git rebase."

  1. Use the Branch drop-down and click Rebase Current Branch.

 

  1. Click the branch you want to rebase into the current branch, then click Start rebase.

 

  1. If you're sure you want to rebase, click Begin rebase.

 

  1. Resolve any merge conflicts in your preferred way, using a text editor, the command line, or another tool.
  2. To push up your local changes, click Force push origin.

你可能感兴趣的:(GitHub Desktop Contributing to projects Working with your remote repository on GitHub or GitHub Enterprise)