是否可以将提交应用于 git 中的所有分支?
我有一种感觉,我在问一些在 git 中无法完成的事情,但我不妨问一下。有什么方法可以让我进行一项更改并将其提交到所有分支吗?例如,假设我想更改我的 AUTHORS 文件或 LICENSE 文件。我知道我可以将更改提交到一个分支,然后将其单独挑选到每个分支。但有没有更简单的方法呢?
I have a feeling I am asking something that can't be done in git, but I might as well ask. Is there any way that I can make one change and commit it to all branches? For instance, suppose I want to make a change to my AUTHORS file or LICENSE file. I know I can commit the change to one branch and then cherry-pick it to each branch individually. But is there an easier way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果分支要合并回主干,或者在主干之上重新建立基础,您不必担心。当这种情况发生时,他们会捡起它。
如果它们是长期存在的分支,您需要将更新的分支合并到其中,或者选择提交。
If the branches are going to be merged back to the trunk, or rebased on top of the trunk, you won't have to worry about it. They'll pick it up when that happens.
If they're long-lived branches, you'll want to either merge the updated branch into them, or cherry-pick the commit.
主题分支可以帮助您。阅读此和这篇博客文章。
What can help you are Topic Branches. Read this and this blog post.