Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update forked project on GitHub

Tags:

git

github

Let's say a repository from which I clone (and only read-only for me) is:

[email protected]:secret_project/dev.git  branch: dev 

I forked project and URL:

[email protected]:secret_user/Dde.git 

(Which I have full access to: read+write)

But someone updated [email protected]:secret_project/dev.git from another forked version.

Let's say file changed on

[email protected]:secret_project/dev.git  (test.txt) content: hi! 

But my forked project has test.txt file with content:

hi 

So how do I update the forked project locally and in my repository?

Which commands should I use? And please make an example with my showed repositories...

like image 781
ZeroSuf3r Avatar asked Feb 08 '11 17:02

ZeroSuf3r


People also ask

How do I update a forked repository?

Go to your fork, click on Fetch upstream , and then click on Fetch and merge to directly sync your fork with its parent repo. You may also click on the Compare button to compare the changes before merging.

Does forked repo automatically update?

Sync from the UI Clicking on that you have the possibility to compare the changes made in the source repo with the ones made in your forked repo, and also to automatically fetch and merge them into your repo.


2 Answers

You should add the remote address for the original repository 'upstream' to your local repository (which is a clone of your Dde.git fork):

git remote add upstream git://github.com/secret_project/dev.git # public read-only URL 

That will allow you to pull 'upstream' into your own branch (merging and resolving any merge conflict in test.txt).
Then you will push your local branch to your Dde GitHub repository.

See GitHub help page: "Working with remotes" for more details.

like image 87
VonC Avatar answered Sep 21 '22 15:09

VonC


Just send out a pull request from your repository's GitHub page to your Parent repository. Then pull the changes in your local forked repo and commit and send a fresh pull request.

like image 43
pseudoCoder Avatar answered Sep 21 '22 15:09

pseudoCoder