同步分支并及时使用GitHub for Windows与项目保持同步 [英] Sync Branch and staying up to date with a project using GitHub for Windows
问题描述
我需要在GitHub for Windows应用程序中执行更新以更新托管在GitHub上的项目或存储库吗?可能不是编辑,但确实想要了解并纳入对项目所做的更改。
当我在桌面上克隆时,使用GitHub for Windows GUI,我有一个选项是同步分支,它被定义为共享您的本地提交服务器,并从别人的变化拉下来。我与谁分享我的本地提交?它是源头吗?而且,我的变化是下拉吗?
好像GUI中的同步分支选项可以同时执行这两项操作(不管我是否愿意)。
您可以分叉回购(即使您不打算回馈),只要保持清晰的链接与原始上游回购。
从那里,您可以:
- 克隆您的本地分支
-
添加远程引用到上游原始回购
git remote add upstream https://github.com/User/repo
-
set the upstream分支到远程上游。
这样,一个简单的git pull
将始终从原始回购中拉出上游
一个)git checkout master
git分支-u upstream / master
-
set
push.default
到匹配
。
这样,一个git push origin
会将所有本地分支(从上游更新)推送到您的分支。git config push.default匹配
这些设置背后的想法是:从上游拉,但推到原点,这意味着跟踪新的更改:您在叉子中记录最后一个SHA1从上游拉出。
这样,您可以从任何工作站
:- 和
拉
来自原始回购的任何新提交。
$ lt; code> pull from
origin
(将您的本地克隆更新为您记忆在您的最后一个SHA1为了检查/查看来自上游
的 What do I need to do in the GitHub for Windows app to stay up to date with changes made to a project or repository hosted on GitHub?
I will most likely not be editing, but do want to stay aware of and incorporate the changes that are made to the project.
When I clone in desktop, using the GitHub for Windows GUI, one of the options I have is "Sync Branch", which is defined as "sharing your local commits on the server and pulling down changes from others". With whom am I sharing my local commits? Is it the origin source? And, whose changes am I "pulling down"?
It seems like the "sync branch" option in the GUI would do both (whether I want to or not).
You can fork the repo (even if you don't intend to contribute back), if only to keep a clear link with the original upstream repo.
From there, you can:
- clone your fork locally
add a remote referring to the upstream original repo
git remote add upstream https://github.com/User/repo
set the upstream branch to the remote 'upstream'.
That way, a simplegit pull
will always pull from the original repo (theupstream
one)git checkout master git branch -u upstream/master
set
push.default
tomatching
.
That way, agit push origin
will push all your local branches (updated from upstream) to your fork.git config push.default matching
The idea behind those settings is: pulling from upstream, but pushing to origin, meaning keep track of the new changes: you record in your fork the last SHA1 you pulled from upstream.
That way, you can from any workstation:
pull
fromorigin
(to update your local clone to the last SHA1 you memorized in your fork),- and
pull
fromupstream
in order to check/see any new commits from said original repo.
这篇关于同步分支并及时使用GitHub for Windows与项目保持同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!