user3239408
user3239408

Reputation: 115

Merge difference code changes from one repository branch to another repository branch

Can anyone help me with this,

My Folder structure is like this :

Repo1 [Repository]
 |- branch1 [branch]

Repo2 [Repository]
 |-branch1 [branch]

Now I need to merge file difference changes from Repo1/branch1 to Repo2/branch1

How do I do that. I am using git [bitbucket] as source control. For GUI I am using sourcetree

Thanks,

krutik

Upvotes: 7

Views: 6149

Answers (1)

Greg Burghardt
Greg Burghardt

Reputation: 18783

It's actually pretty easy if both "repos" are forks of the same repository. If they are truly different repositories completely, the merge gets a little messy, but is certainly possible.

The basic steps:

cd Repo2/branch1
git remote add Repo1 ../Repo1/branch1/.git
git fetch Repo1
git merge Repo1/branch1 --allow-unrelated-histories

That should trigger a regular "git merge" scenario. Even if both repos are actually 100% separate, Git will still do the merge, but won't be able to auto merge any differences between files.

Upvotes: 7

Related Questions