I have a git repository on BitBucket with multiple branches and I want to fork this repository with all its branches to give an access to an external collaborator. My question is it possible to merge a commit from a specific branch of the original repository to the forked one knowing that that nothing has changed in the forked repository? If yes, what are the necessary steps to do that?
Asked
Active
Viewed 402 times
2 Answers
1
Yes, you can pull commits from the original repository. There are two ways to do this:
Create a pull request in the forked repo from the original.
Clone the forked repo to a local repo. Then add a remote for the original:
$ git clone <forked repo URL> $ git remote add upstream <original repo URL>
Now you have two remotes.
origin
refers to your forked repo andupstream
refers to the original. To merge from the original into your forked repo do this:$ git checkout my-branch $ git pull upstream my-branch $ git push origin my-branch
Instead of my-branch
, you can put any branch name you wish.

Code-Apprentice
- 81,660
- 23
- 145
- 268
1
If I understand correctly, you want to merge branch-a
from local original-repo
to branch-b
of remote forked-repo
.
If so, this may be a duplicate of: Merge git repo into branch of another repo

Joshua Manns
- 525
- 4
- 6