I forked a repo and the original repo has gotten a new branch after I forked it.
OriginalRepo
|
+-BranchA
|
+-newBranch
MyFork
|
+-BranchA
I want to get the branch newBranch into my fork, how can I do this?
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.
The git branch command can be used to create a new branch. When you want to start a new feature, you create a new branch off main using git branch new_branch . Once created you can then use git checkout new_branch to switch to that branch.
When merging a fork, git effectively has to diff both entire codebase against one another, as a fork represents two full copies of the codebase. Forking creates a full copy of your repository, whereas branching only adds a branch to your exiting tree.
git remote add OriginalRepo repository-URL
git fetch OriginalRepo
git checkout newBranch
git push origin newBranch
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