[英]How to track changes from a remote master repository and use git pull?
I forked a group repository to my own personal repository. 我将群组存储库分叉到自己的个人存储库中。
Instead of keeping my forked repository up to date using: 而不是使用以下方法使我的分支存储库保持最新:
$ git co master
$ git fetch upstream
$ git rebase upstream/master
Is there a way I can set up my forked repository to track changes from the remote master repository and do something simple like this? 有没有一种方法可以设置我的分支存储库,以跟踪远程主存储库中的更改并执行类似的简单操作?
$ git co master
$ git pull
Is there a way I can set up my forked repository to track changes from the remote master repository and do something simple like this?
有没有一种方法可以设置我的分支存储库,以跟踪远程主存储库中的更改并执行类似的简单操作?
Not on GitHub . 不在GitHub上 。 If you have access to a VPS you could create a Cronjob that performs the first task for you automatically.
如果您有权使用VPS,则可以创建一个Cronjob,它会自动为您执行第一个任务。
You can set up a different push and pull origin if you want to: First set URL of the original one 如果需要,可以设置不同的推拉原点:首先设置原始的URL。
$ git remote set-url origin url-to-the-original/global.git
Then set the push origin to your forked one $ git remote set-url origin url-to-the-original/global.git
然后将push origin设置为分叉的
$ git remote set-url --push origin url-to-fork/forked.git
You can set for the checked out branch a remote tracking branch: 您可以为检出分支设置远程跟踪分支:
$ git branch -u <remote_name>/<remote_branch>
In most cases this will be: 在大多数情况下,这将是:
$ git branch -u origin/master
Every subsequent git pull
will automatically use this remote branch. 随后的所有
git pull
将自动使用此远程分支。
For rebasing you can use the -r
flag of pull 要重新定级,可以使用pull的
-r
标志
$ git pull -r
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.