I have a repository on github, and someone else has forked it and made changes.
I want to:
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!
Once you have cloned your forked repo, you do need to add a remote pointing to the original like the previous answer said. They like to call it upstream, but it doesn't matter. The problem is that if you already have changes, the changes you incorporate will create a merge commit.
Pull new changes from remote: git checkout master , git pull upstream master . Sync dev branch: git checkout new_feature , git merge master . Push changes to your remote repository: git push origin new_feature . Open a pull request on GitHub merging your changes with the upstream (original) repository.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With