如何在git具有相同abc文件和其他开发人员的新更改的旧版本abc文件中提交我的更改? [英] How to submit my changes in abc file which is old version while git has same abc file with new changes by other developer?
问题描述
更清楚地说,我在远程存储库中使用了很长时间的abc文件,而其他一些开发人员在同一个文件上进行了新的更改并合并了.很长时间后,我签出了我的旧提交,其中包含旧版本的abc文件,并开始进行更改并将其推送.
To be more clear, I was working on file abc which was in my remote repository for a long time and some other developer worked on same file made new changes and merged. I checkout to my old commit after a long time which has old version of abc file and start make changes and push it.
当我将更改与基本文件(abc的最新版本)进行比较时,发现了一些新更改,并且我们的项目需要进行新更改.我不想替换其更改,但是如何将更改与最新版本的abc文件合并而不是替换.
When I compare my changes with base file (recent version of abc) some new changes are found and that new changes are required for our project. I do not want to replace their changes But how can I merge my changes with the latest version of abc file instead of replacing.
推荐答案
您只需要重新设置您的更改即可.
You just need to rebase your change.
您可以尝试使用Gerrit UI执行变基:
You can try to use the Gerrit UI to perform the rebase:
1)在Gerrit用户界面中进行更改 2)点击重新设置"按钮 3)再次单击重新设置"按钮
1) Go to your change in the Gerrit UI 2) Click on "Rebase" button 3) Click on "Rebase" button again
如果要解决冲突,您将收到一条错误消息,并且需要在本地存储库中手动执行变基以解决冲突:
If you have conflicts to be resolved you'll receive an error message and you'll need to perform the rebase manually in your local repository to resove de conflicts:
1)更新您的本地存储库
1) Update your local repository
git fetch
2)重新确定您的提交(相应地更改分支)
2) Rebase your commit (change the branch accordingly)
git rebase origin/master
3)如果发现冲突,请解决
3) If you find conflicts, resolve them
git mergetool
4)完成后,提交更改
4) When you're done commit your changes
git rebase --continue
5)将您的新提交(补丁集)推送到Gerrit
5) Push your new commit (patchset) to Gerrit
git push origin HEAD:refs/for/master
这篇关于如何在git具有相同abc文件和其他开发人员的新更改的旧版本abc文件中提交我的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!