Git Rebase或Git Merge? [英] Git Rebase or Git Merge?

查看:70
本文介绍了Git Rebase或Git Merge?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个分支.两者都是功能分支-new-uivideo-upload. video-uploadnew-ui的分叉.

I have two branches. Both are feature branches - new-ui and video-upload. video-upload is a fork of new-ui.

但是,video-upload有很多提交.我有多个开发人员在new-ui上工作,其中一个刚刚完成了video-upload.但是我不太清楚哪个将两者结合起来会更清洁.

However, video-upload has a TON of commits. I have multiple developers working on new-ui, and one just completed video-upload. But I can't quite figure out which will be the cleaner option to combine the two.

我想将video-upload中已完成的工作带到new-ui中,但是我不知道是否要完全擦除video-upload的所有提交,并使用新的new-ui创建新的提交历史记录提交.感觉就像是一团糟.

I want to bring the completed work in video-upload into new-ui, but I don't know if I want to completely erase all the commits for video-upload and create a new commit history for new-ui with new commits. That feels like it will be messy.

但同时,我希望功能完全合并.

But at the same time, I want a clean merge of the functionality.

由于已分叉video-upload,因此已经在new-ui上完成了工作.因此合并/组合将变得不干净.

Work has been done on new-ui since video-upload has been forked. So the merge/combination is not going to be clean.

考虑到上述情况,哪种方法最好,为什么?

Considering the above, which approach is best and why?

推荐答案

合并正是为此目的的-发行包含来自两个或多个分支的开发的版本.

Merge is exactly for that - shipping a version that includes development from two or more branches.

Rebase用于重写历史记录":具有合并的主干,该主干包括来自多个分支的提交,但看起来像单调流.

Rebase is for "rewriting history": to have a consolidated main trunk that includes commits from several branches but looks like a monotonic stream.

这篇关于Git Rebase或Git Merge?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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