Update forked project on GitHub

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

git@github.com:secret_project/dev.git  branch: dev

I forked project and URL:

git@github.com:secret_user/Dde.git

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

But someone updated git@github.com:secret_project/dev.git from another forked version.

Let's say file changed on

git@github.com: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...


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.


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.


The steps here will move your fork to the same commit as the parent repository:

  • Change directory to your local repository. Switch to master branch if you are not and type this git checkout master
  • Add the parent as a remote repository, git remote add upstream <repo-location>
  • Issue git fetch upstream
  • Issue git rebase upstream/master At this stage you check that commits what will be merged by typing git status
  • Issue git push origin master
  • 链接地址: http://www.djcxy.com/p/18076.html

    上一篇: Git子模块新版本更新

    下一篇: 在GitHub上更新fork项目