How do you pull changes from the parent of a fork in Git, specifically in a github configured project?
For example, say I forked http://github.com/originaluser/originalproject into http://github.com/myuser/myproject. I don't plan on myproject on being a permanent fork, as I only want to maintain a "dev" branch to test some experimental features, and then eventually merge it back into the original project.
As such, whenever commits are made to originalproject, I want to be able to pull them down and merge them with myproject. However, I also want to be able to push changes up into myproject, but not yet immediately create a pull request to get them merged into originalproject until my branch is complete and tested. What's the best way to do this?
Edit: By default, when I create a local checkout/fork of my github fork for local development, and then push/pull changes up, these changes only effect my personal fork. I never get changes from the original project. How do I fix that?
Sorry for any incorrect git terminology.
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.
Expanding on other answers, these are the steps I took on a fork I had of tsc-watch:
git remote add upstream https://github.com/gilamran/tsc-watch.git git fetch upstream git merge upstream/master git push
Explained:
upstream
(alias)upstream
remoteupstream/master
branch into my current branchYou can add the parent repository (upstream) as another remote branch. Something like
git remote add upstream ...
and then you can just git fetch to see any changes and then rebase/merge... whatever.
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