对Git中的多个分支提交更改 [英] Commit a change to more than one branch in Git
问题描述
典型的使用场景:
我有master,branch_foo和branch_bar。所有都是最新的。现在,我做了一个git checkout master并开始修复错误。
可以说修复是在所有分支处于相同状态的跟踪文件上 - 即。在修复之前,来自每个分支的文件的差异不会导致差异。
有没有办法将此修复提交到所有分支?
我期待 git cherry-pick
是你想要的。
将修复提交到第一个分支后,可以使用 git cherry-pick
将其合并到每个其他分支中。
这个相关的SO问题可能是有趣的:
Git&在多个分支上工作
Typical usage scenario:
I have master, branch_foo and branch_bar. All are up to date. Now, I do a "git checkout master" and work on a bug fix.
Lets say that fix was on a tracked file that is in the same state on all branches - ie. before the fix, a diff of the file from each branch results in no differences.
Is there a way to commit this fix to all branches?
I expect git cherry-pick
is what you want.
After committing the fix to the first branch, you can use git cherry-pick
to merge it into each of the other branches.
This related question on SO may be of interest: Git & Working on multiple branches
这篇关于对Git中的多个分支提交更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!