英文:
Commit specific commit of another project
问题
有没有办法将另一个用户在另一个存储库上创建的提交添加到我的存储库中,还是我需要手动逐个文件进行操作?
英文:
I have created a fork of a repository (https://github.com/datso/react-native-pjsip) And made my own changes on him, but there's another repository with changes (https://github.com/moisesynfam/react-native-pjsip/commit/845801c331b9a530a542fc18fb88217ee6ee8f5c) that i want to make on my own repository (https://github.com/willnaoosmit/React-native-sip-pjsip)
It's there a way to commit on my repository a commit made by another user on another repository? Or i need to make this file to file by hand?
答案1
得分: 2
以下是翻译好的部分:
你可以在本地副本上拥有多个远程仓库:
-
选择如何命名这个第二个远程仓库(我将使用"moisesynfam"作为示例):
git remote add moisesynfam https://github.com/moisesynfam/react-native-pjsip
-
从这个仓库获取更改:
git fetch moisesynfam
-
现在,您可以访问其所有已发布的提交:
git cherry-pick 845801c33
您仍然可以使用"origin"远程仓库将任何内容推送到您自己的克隆版本:
git push origin ...
英文:
You can have several remotes on your local copy :
-
choose how to name this second remote (I will use "moisesynfam" as an example) :
git remote add moisesynfam https://github.com/moisesynfam/react-native-pjsip
-
fetch changes from this repo :
git fetch moisesynfam
-
you can now access all of its published commits :
git cherry-pick 845801c33
You can still push anything to your own clone using the origin
remote :
git push origin ...
答案2
得分: 2
You will need to use cherry-pick
Follow these steps:
add the 2 remotes to your repository
git remote add
"Grab" the content of all the branches
git fetch --all --prune
Checkout the destination branch
git checkout
"Apply" the change
git cherry-pick
英文:
>It's there a way to commit on my repository a commit made by another user on another repository? Or i need to make this file to file by hand?
You will need to use cherry-pick
Follow these steps:
# 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->
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论