Hey folks, I need some help with GitHub forks. I’ve got this project I forked a while back, but now the original repo has a new branch I want to add to my fork. I’m not sure how to do this.
But that’s not working right. It’s trying to push back to the original repo when I do git push, which isn’t what I want.
What I’m trying to do is get that new branch into my local repo so I can push it to my fork on GitHub. You know, since we can’t usually write to the original repo directly.
Any ideas on how to set up a new branch in my fork that matches the one from the original repo? Thanks!
yo danielr, i gotchu. add the OG repo as remote: git remote add upstream . then fetch: git fetch upstream. make new branch: git checkout -b new-branch upstream/new-branch. finally push: git push -u origin new-branch. shud work!
At this point, you’ve got the new branch locally. To get it on your GitHub fork, just push:
git push origin new-branch
This method has always worked smoothly for me. It keeps your fork updated and lets you work with new branches easily. Just remember to periodically sync your fork to stay current with the original repo.
Now you have the new branch locally. To push it to your fork on GitHub:
git push -u origin new-branch
This should create the new branch in your fork, matching the one from the original repository. Remember to keep your fork synced regularly to avoid falling behind on updates.
hey danielr, try adding the original as remote: git remote add upstream then fetch new-branch with git fetch upstream new-branch:new-branch and finally git push origin new-branch. hope this helps!