Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
636 views
in Technique[技术] by (71.8m points)

github - Can I update a forked project, on git, to the original/master copy?

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?)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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:

enter image description 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.

enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...