如何将一个分支的更改转移到另一个分支,如果文件名已更改?

huangapple go评论60阅读模式
英文:

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 mergegit pullgit 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.

huangapple
  • 本文由 发表于 2020年8月29日 00:45:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/63637886.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定