英文:
How to transfer changes from one branch to another if file name changed?
问题
我有一个分支a,在那里我正在处理file1。另一个人在类似的分支b上工作。他在那里进行了许多更改,并将file1重命名为file2。我应该切换到他的分支并将我的更改转移到他的分支。我该怎么做?据我了解,stash不是一个解决办法,因为文件名已更改,在应用stash后文件不会出现。如何将文件a(分支a)的更改转移到文件b(分支b)?
英文:
I have branch a, where I'm work with file1. Another man work with similar branch b. He made many changes there and renamed file1 to file2. I should checkout to his branch and transfer my changes to his branch. How can I do this? As I understand, stash is not a solution, because file name changed and after stash applying file doesn't appear. How to transfer changes from that file1(branch a) to file2(branch b)?
答案1
得分: 1
使用git merge
,git pull
或git cherry-pick
,就像通常情况下一样,将更改从一个分支合并到另一个分支。Git通常能够智能地检测名称更改,并将更改以及名称更改合并在一起。如果存在冲突,您将不得不处理它。这可能有点令人困惑,因此使用一个好的合并工具会有帮助。
英文:
Use git merge
, git pull
or git cherry-pick
as you would normally would
...to bring changes from one branch to another. Git is usually smart about detecting the name changes and will merge the changes and the name change. If there is a conflict, you will have to handle it. It can be a little confusing, so using a good merge tool helps.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论