简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM