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
639 views
in Technique[技术] by (71.8m points)

github - Git merge from someone else's fork

I have a repository on github, and someone else has forked it and made changes.

I want to:

  1. Create a new branch
  2. Merge their changes into my branch

I have created the new branch:

git commit -b my_new_branch

How do I merge their code into this new branch?

This is the branch that I have created: https://github.com/poundifdef/VirginMobileMinutesChecker/tree/widget_toast

This is the branch that I want to merge: https://github.com/xbakesx/VirginMobileMinutesChecker

What is the best way to do this? I've tried a "pull" and it won't work. I honestly have no idea what I'm doing in gitland, so if there is a better way to accomplish this (besides my creating a branch and trying to merge) then I am all ears!

See Question&Answers more detail:os

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

1 Reply

0 votes
by (71.8m points)

Add their github fork repo as a remote to a clone of your own repo:

git remote add other-guys-repo <url to other guys repo>

Get their changes:

git fetch other-guys-repo

Checkout the branch where you want to merge:

git checkout my_new_branch

Merge their changes in (assuming they did their work on the master branch):

git merge other-guys-repo/master

Resolve conflicts, commit the resolutions and voila.


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

1.4m articles

1.4m replys

5 comments

56.9k users

...