GitHub for Windows 的“同步”功能是什么?

使用 GitHub for Windows,您可以“发布”一个分支,然后将该分支“同步”到 GitHub。

enter image description here

同步基本上是 git pullgit push吗?还是还有别的原因?如果我想执行与从命令行“ sync”完全相同的步骤,我应该做什么?

(它不是开源的,否则我就直接读了。)

47700 次浏览

"Sync" would be any actions necessary to have your local branch match your remote branch. If your local branch had commits that your remote branch didn't, then "sync" would push your branch. If the remote branch was ahead of your local branch, then "sync" would pull first (specifically, git pull --rebase, as was explained by Phil Haack). "Sync" is just a shortcut to getting the local and remote to mirror each other.

From the GitHub site:

The sync button turns the complex workflow of pulling and pushing into a single operation. It notifies you when there are new changes to pull down and lets you quickly share local changes.

Sync does git pull --rebase and then if there are local changes, it does git push.

From here: http://haacked.com/archive/2012/05/21/introducing-github-for-windows.aspx#87318

Since the above answer was more than two years ago, an updated answer to this question is: due to some bugs with rebase, the "sync" button does not do git pull --rebase anymore. Instead, it does git pull which will do merge if there are conflicts, according to this release notes (see release 1.3.0).

The link above is not available at this time. Here is the new release notes.

To add to @ethanyang's answer,

According to the alias configured in the gitconfig,

[alias]
...
sync = !git pull && git push