我可以在git上更新一个分叉项目到原始/主副本吗? [英] Can I update a forked project, on git, to the original/master copy?

查看:129
本文介绍了我可以在git上更新一个分叉项目到原始/主副本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几周前,我在GitHub上发布了一个公共项目。今天,我想尝试一些东西,但我想确保我使用的副本是最近的。



我可以先更新我的叉子吗?



如果在我开始更改之后叉子发生变化,会发生什么情况。我可以再次更新我的叉子,同时在那里留下我的更改(即合并,如果需要吗?)

解决方案

可以将拉出从原始仓库到您的货叉的更改。



来自GitHub的帮助:



>首先,向原始回购添加一个遥控器。



这里的帮助: http://help.github。 com / remotes /



然后,您可以更新原始回购协议。引用自 http://help.github.com/fork-a-repo/


拉动上游变动

获得更新后,您
可以通过运行以下代码将这些更新添加到您的分支:

$ git fetch upstream

$ git merge upstream / master


所有这些都是从命令行执行的。



下面是对TortoiseGit的说明:

右键点击您的项目 - > TortoiseGit - >设置 - >远程。



在这里添加远程详情:


现在,右键单击 - > TortoiseGit - > Pull。



您将看到一个对话框来选择遥控器(您应该能够看到您在上一步中添加的遥控器)。选择它并拉。




A few weeks ago i forked a public project on GitHub. Today, I wish to try some stuff on it BUT i want to make sure the copy I use is the most recent.

Can I update my fork, first?

And what happens if there's changes to the fork AFTER i've started my changes. Can i update my fork again, while leaving my changes in there (ie. merge, if needs be?)

解决方案

Yeah you can pull the changes from the original repo into your fork. Add a remote to it ( since origin will be your fork ) and pull.

This from GitHub help:

First up, add a remote to the original repo.

Help here: http://help.github.com/remotes/

Then you can pull in updates to the original repo. Quote from http://help.github.com/fork-a-repo/

Pull in upstream changes

If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:

$ git fetch upstream

$ git merge upstream/master

All these are for doing from command line.

Below are instructions for TortoiseGit:

Right click over your project -> TortoiseGit -> Settings -> Remote.

Add the remote details here:

Now, right-click -> TortoiseGit -> Pull.

You will be presented with a dialog to choose the remote ( you should be able to see the remote you added in previous step). Choose it and pull.

这篇关于我可以在git上更新一个分叉项目到原始/主副本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆