How to submit my changes in abc file which is old version while git has same abc file with new changes by other developer?

核能气质少年 提交于 2019-12-25 03:19:09

问题


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.

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.


回答1:


You just need to rebase your change.

You can try to use the Gerrit UI to perform the rebase:

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) Update your local repository

git fetch

2) Rebase your commit (change the branch accordingly)

git rebase origin/master

3) If you find conflicts, resolve them

git mergetool

4) When you're done commit your changes

git rebase --continue

5) Push your new commit (patchset) to Gerrit

git push origin HEAD:refs/for/master


来源:https://stackoverflow.com/questions/50042254/how-to-submit-my-changes-in-abc-file-which-is-old-version-while-git-has-same-abc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!