GitHub for Windows的“同步”有什么作用?

时间:2012-08-24 06:54:53

标签: git github-for-windows

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

enter image description here

同步基本上是git pullgit push吗?或者还有更多吗?如果我想从命令行执行与“sync”完全相同的步骤,我该怎么办?

(这不是开源,或者我只是读过它。)

4 个答案:

答案 0 :(得分:51)

同步执行git pull --rebase,如果有本地更改,则会git push

从这里开始:http://haacked.com/archive/2012/05/21/introducing-github-for-windows.aspx#87318

答案 1 :(得分:42)

由于上述答案是两年多以前的答案,对此问题的更新答案是:由于 rebase 的一些错误,“同步”按钮不再执行git pull --rebase 。相反,如果存在冲突,它会执行 git pull 合并,根据此release notes(请参阅版本1.3.0)。

目前无法使用上述链接。这是the new release notes

答案 2 :(得分:14)

“同步”是让本地分支与远程分支匹配所需的任何操作。如果您的本地分支已提交您的远程分支没有,那么“sync”会推送您的分支。如果远程分支位于您的本地分支之前,那么“sync”将首先拉出(具体地,git pull --rebase,而Phil Haack则为explained。 “同步”只是让本地和远程互相镜像的捷径。

来自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.

答案 3 :(得分:4)

添加到@ ethanyang的answer

根据gitconfig中配置的别名

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