Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

git - Update forked project on 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...

See Question&Answers more detail:os

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

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...