git 有两个分支 a、a->b, a 有更新以后用什么语句更新到 b?

2015-09-07 11:28:50 +08:00
 zioc

a :当前线上版本,需要不断修复 bug
b :来源于 a ,在 b 上面开发新模块

两个分支都要保留,不能删除。

在 a 上面更新代码以后,怎么也更新到 b ?

4917 次点击
所在节点    git
27 条回复
NemoAlex
2015-09-07 13:11:51 +08:00
在 b 上 merge a 就可以了啊,没有什么必要 rebase 。
cherry pick 会产生很多新的 commit ,更没有必要了。
msg7086
2015-09-07 13:32:09 +08:00
@NemoAlex 用 b rebase a 就可以了啊,没有什么必要 merge 。
nigelvon
2015-09-07 13:34:42 +08:00
rebase 被玩坏了
ShadowStar
2015-09-07 13:56:35 +08:00
建议用 merge

rebase 可能会导致 non-fastforward
cherry-pick 少量 commit 没问题,多了累
laucie
2015-09-07 14:03:21 +08:00
没有争议的问题 为啥还讨论这么激烈 蛋疼
alexapollo
2015-09-07 14:18:26 +08:00
git rebase -i <branch> 是正确的用法
zongwan
2015-09-07 23:18:30 +08:00
On branch B

1. branch_b clean
git merge branch_a

2. branch_b can not merge before commit
git stash
git merge branch_a
* may need fix confilct then
git stash pop

遇到不可合并的二进制文件,需要重新 git checkout file

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/218802

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX