变基后是否需要执行提交?
我刚刚将一个功能分支重新设置为另一个功能分支(准备将所有内容重新设置为我的主人的头),并且它涉及相当多棘手的合并解决方案。
变基是否会自动保存为某处的提交?
这些修改到底在哪里?我在 gitk 或 git log --oneline 中看不到任何内容。
(当我在变基后合并回我的分支时,同样的问题。)
I've just rebased a feature branch onto another feature branch (in preparation for rebasing everything to the head of my master), and it involved quite a few tricky merge resolutions.
Is the rebase automatically saved as a commit somewhere?
Just where do those modifications live? I can't see anything in gitk, or git log --oneline
.
(Same question for when I merge back my branch after rebasing.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Rebase 正在将提交移动到另一个分支之上。如果移动的提交导致合并冲突,则会更改此提交以反映合并解决方案。
变基的目的是让您的提交看起来就像是对您变基的分支的更改。因此,最合乎逻辑的方法是将合并冲突合并到这些提交中。因此不需要额外的提交。
合并是不同的,因为它是将分歧的分支合并在一起的显式操作。每个分支中的提交都不会更改。冲突解决反映在合并提交中。
Rebase is moving commits on top of another branch. If a commit that is moved causes merge conflict, this commit is changed to reflect merge resolution.
The purpose of rebase is make your commits look as if they were changes to the branch you rebase onto. So the most logical way is to incorporate merge conflicts into these commits. No additional commits is required thus.
Merge is different, because it's an explicit action of merging diverged branches together. No commits in each of branches is changed. Conflict resolution is reflected in the merge commit.
是的,成功的变基和合并会产生提交。他们只是不会提交需要解决的冲突,但是变基(或合并)的输出会告诉您这种情况已经发生以及如何解决。
对于变基,您只需要解决索引中的冲突,然后
git rebase --continue
。对于合并,您需要进行提交 (
git commit
),但系统会记住这是一次合并,并且会提供合适的默认提交消息供您编辑。Yes, successful rebases and merges make commits. They only won't make a commit of there are conflicts that need resolving, but then the output of the rebase (or merge) will tell you that this has happened and how to resolve it.
For a rebase, you just need to resolve the conflicts in the index and then
git rebase --continue
.For a merge, you need to make the commit (
git commit
), but the fact that it's a merge will be remembered and a suitable default commit message will be supplied for you to edit.过去(2006 年,1.5.3 之前和 它的用户手册),
git rebase
是因此根据定义,将进行提交(并且无需进行提交)
变基的一个特殊情况是当您想要划分工作、移动(并重新创建新的)提交时。
来自同一个教程(作为变基后不需要任何进一步提交的说明):
In the old days (2006, before 1.5.3 and its user manual),
git rebase
was presented like so:So by definition, commits will be made (and no commit need to be done)
A special case of rebase is when you want to divide your work, moving (and recreating new) commits.
From the same tutorial (as an illustration of not needing any further commit after a rebase):