Git:同时承诺多个分支 [英] Git: Commit to multiple branches at the same time

查看:138
本文介绍了Git:同时承诺多个分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在同一时间在不同的分支上进行一次提交,因为在我的项目中,我为不同的客户提供了不同的分支。

I want to make a single commit on different branches at the same time, since, in my project, I have different branches for different clients.

在分支A上提交了新的功能。我是否也可以同时在分支B,分支C和D上进行此项提交?有没有捷径命令?这对于签出一个分支来说是非常麻烦的,每次有时候,如果在许多分支上需要提交,这对我来说将是一场噩梦。

Say, I have made a new feature commit on Branch A. Can I also make this commit on Branch B, Branch C and D at the same time as well? Is there any short cut command for this? This is very troublesome to checkout one branch, and cherrypick the commit everytime, sometime, if the commit is necessary on many branches, it would be a nightmare for me.

任何这个操作简单的bash脚本?

Any simple bash script for this operation?

有一个在那里。但rebasing不是我想要的。

There is a similar question in there. but rebasing is not that I want.

推荐答案

樱桃挑选功能将完成这项工作,并且仅应用最后一次提交:

The cherry-pick feature will do the job and will only apply the last commit:

考虑分支A,B

git checkout A
git commit -m "Fixed the bug x"
git checkout B
git cherry-pick A

希望这有助于!

这篇关于Git:同时承诺多个分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆