简体   繁体   English

将更改从一个Git存储库转移到另一个

[英]Transfer changes from one Git repo to another

There is a UserA and two Git repositories - repoA and repoB, UserA has write access to repoB but read access only to repoA. 有一个UserA和两个Git存储库-repoA和repoB,UserA具有对repoB的写访问权,但仅对repoA具有读访问权。 I have write access to both repositories. 我对两个存储库都有写权限。 UserA commit changes to repoB and I need to transfer these changes to repoA. UserA将更改提交到repoB,我需要将这些更改转移到repoA。

Is it possible to do it in BitBucket webpage or natively in Git? 是否可以在BitBucket网页中或在Git中本地进行?

git clone <repoA_url> -- myrepo
cd myrepo
git remote add rb <repoB_url>
git fetch rb <branch_userA_pushed_to>
git branch repob FETCH_HEAD
#assuming you are working on repoA's master
git checkout master

Now you could manipulate master and repob . 现在您可以操纵masterrepob UserA's changes(commits) are on repob . UserA的更改(提交)在repob You could run git rebase or git merge or git cherry-pick to apply UserA's changes onto master . 您可以运行git rebasegit mergegit cherry-pick来将UserA的更改应用于master

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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