提交另一个项目的特定提交

时间:2020-01-03 14:39:34

标签: git github

我创建了一个存储库(https://github.com/datso/react-native-pjsip的分支,并对他进行了自己的更改,但是我想在我自己的存储库({ {3}})

有没有办法在我的存储库中提交另一个用户在另一个存储库中提交的提交?还是我需要手工制作此文件?

2 个答案:

答案 0 :(得分:2)

您可以在本地副本上拥有多个遥控器:

  • 选择如何命名第二个遥控器(我将使用“ moisesynfam”作为示例):

    git remote add moisesynfam https://github.com/moisesynfam/react-native-pjsip
    
  • 从此存储库中获取更改:

    git fetch moisesynfam
    
  • 您现在可以访问其所有已发布的提交:

    git cherry-pick 845801c33
    

您仍然可以使用origin遥控器将任何内容推送到您自己的克隆中:

git push origin ...

答案 1 :(得分:1)

有没有办法在我的存储库中提交另一个用户在另一个存储库中提交的提交?还是我需要手工制作此文件?

您将需要使用樱桃采摘

请按照以下步骤操作:

# add the 2 remotes to your repository
git remote add <origin2> <url>

# "Grab" the content of all the branches
git fetch --all --prune    

# Checkout the destination branch
git checkout <branch>

# "Apply" the change
git cherry-pick <SHA1->

enter image description here


enter image description here

相关问题