git 使用 GitHub 桌面客户端进行上游拉取
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11394349/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Upstream pulls with the GitHub desktop client
提问by Joost Schuur
I can't seem to find an option to perform a 'git pull upstream master' using the Mac desktop client for GitHub (currently 1.2.13). Is that supported yet outside of the command line?
我似乎找不到使用 GitHub 的 Mac 桌面客户端(当前为 1.2.13)执行“git pull upstream master”的选项。在命令行之外还支持吗?
采纳答案by Paul Sheldrake
The Github client does not support this feature as far as I can tell.
据我所知,Github 客户端不支持此功能。
The way to work around this you can change the primary repo to the upstream repo that you want to use and then change the repo back to your own.
解决此问题的方法是,您可以将主存储库更改为您要使用的上游存储库,然后将存储库更改回您自己的存储库。
- Go to the settings tab
- Change the "Primary remote repository" to the upstream repo you want to use.
- Press "Update Remote"
- Press "Sync Branch"
- Change the "Primary remote repository" back to the original forked repo you were using.
- Press "Update Remote"
- 转到设置选项卡
- 将“主远程存储库”更改为您要使用的上游存储库。
- 按“更新遥控器”
- 按“同步分支”
- 将“主远程存储库”更改回您使用的原始分叉存储库。
- 按“更新遥控器”
And you're done.
你已经完成了。
回答by Christopher
According to the mac client's homepage, the "sync button" will perform this operation for the configured remote repository.
根据mac客户端的主页,“同步按钮”将对配置的远程存储库执行此操作。
Synchronize branches
The sync button pushes your changes to GitHub and pulls down other's changes in one operation. It notifies you when you have changes you haven't pushed or there are new changes on GitHub you haven't pulled down.
同步分支
同步按钮将您的更改推送到 GitHub,并在一次操作中下拉其他人的更改。当您有尚未推送的更改或 GitHub 上有您尚未下拉的新更改时,它会通知您。
I can't find a way to support multiple remotes with the current version of the client (Version 1.2.13 (b919fb2)), but in a pinch I suppose you could change the "Primary remote repository" under "Settings" on the left sidebar.
我找不到使用当前版本的客户端(版本 1.2.13 (b919fb2))支持多个遥控器的方法,但在紧要关头,我想您可以更改左侧“设置”下的“主要远程存储库”侧边栏。
回答by Michael Scott Cuthbert
It is possible to do it with recent versions of the GitHub client (at least the Mac version), but it's not particularly easy.
使用最新版本的 GitHub 客户端(至少是 Mac 版本)可以做到这一点,但这并不是特别容易。
The process involves syncing the master version down to your computer as a second fork and then making a pull request to yourself. It's convoluted enough that I made a blog post explaining how to do it:
该过程涉及将主版本作为第二个分支同步到您的计算机,然后向自己发出拉取请求。太复杂了,我写了一篇博文解释了如何做到这一点:
http://prolatio.blogspot.com/2015/08/merge-upstream-into-your-fork-in-github.html
http://prolatio.blogspot.com/2015/08/merge-upstream-into-your-fork-in-github.html
[edit: the newest Beta of the GitHub desktop app, released by 12 Aug. 2015, makes it possible to do so much more easily. This answer will become obsolete soon.]
[编辑:GitHub 桌面应用程序的最新 Beta 版于 2015 年 8 月 12 日发布,可以更轻松地完成这项工作。这个答案很快就会过时。]
回答by ajmedway
Here is the way I do this...
这是我这样做的方式...
Firstly, launch a terminal window at the repo root
首先,在 repo 根目录启动一个终端窗口
Then you can run git remote -v
to inspect the currently wired up remotes. Here I can see that the source repo is referenced by name upstream
然后您可以运行git remote -v
以检查当前已连接的遥控器。在这里我可以看到源代码库是按名称引用的upstream
Then you can either do a pull into your current local branch with git pull <remote> <branchname>
然后,您可以使用以下命令拉入当前的本地分支 git pull <remote> <branchname>
Alternatively, to reset your branch index and working tree to the latest commit of the upstream remote, just use git reset --hard upstream/master
或者,要将分支索引和工作树重置为上游远程的最新提交,只需使用 git reset --hard upstream/master