清理主分支,但也有中间提交的详细记录 [英] Clean master branch but also detailed record of intermediary commits

查看:217
本文介绍了清理主分支,但也有中间提交的详细记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

:保持主人的清晰历史记录,同时保留中间提交。 ,让我们从一个主分支开始:

  M1 --- M2 --- M3 
^
master

我研究一个新的分支上的特性/错误/无论如何:

  M1 --- M2 --- M3 
^ \
| \- F1 --- F2 - F3
| ^
主要功能

当我融入主人时,我想 M3 作为父项,但也保留从 M3 到达新提交的迭代。这可以通过 merge --no-ff 完成:

  M1 --- M2 --- M3 ----------------------- M4 
\ / ^
\- F1 - - F2 - F3- / master
^
功能

这几乎是我想到的是什么。我的问题是,就git而言,据我所知, M3 F3 都是相等的父母 M4 ,现在既是分支的一部分 master



< ( git log )没有特性分支的主分支( F1-F3 )在分支上拥有更清晰的视图。理想情况下,这将是默认的。但也可以显示 F1 F3 提交,以便在需要时查看更详细的历史记录。



有没有办法在 git


<解决方案


引用手册


在看到合并提交时,只跟随第一个父提交。当查看特定主题分支的演变时,此选项可以提供更好的概述,因为合并到主题分支往往只是适应不断更新的上游时间,并且此选项允许您忽略单独提交到您的历史合并。



Goal: keep a clean history of master, whilst also keeping the intermediary commits.

For instance, let's start with a master branch:

M1 --- M2 --- M3
              ^                  
              master

I work on a feature/bug/whatever on a new branch:

M1 --- M2 --- M3
              ^  \
              |   \- F1 --- F2 -- F3
              |                   ^
              master              feature

And when I merge into master, I want M3 to be the parent, but also keep the "iterations" you took to reach from M3 to the new commit. This can be done with merge --no-ff:

M1 --- M2 --- M3 ----------------------- M4
                 \                    /  ^
                  \- F1 --- F2 -- F3-/   master
                                  ^
                                 feature

Which is almost what I had in mind. The problem I have is that for git, as far as I can tell, both M3 and F3 are "equal" parents of M4, now both part of branch master.

What I want is to be able the show (with git log) the master branch without the feature branch (F1-F3) to have a cleaner view over the branch. ideally this would be default. But also be able to show the F1 F3 commits to view the more "detailed" history when needed.

Is there a way to have this, or something close to this in git?

解决方案

How about

git log --first-parent master

To quote the manual

Follow only the first parent commit upon seeing a merge commit. This option can give a better overview when viewing the evolution of a particular topic branch, because merges into a topic branch tend to be only about adjusting to updated upstream from time to time, and this option allows you to ignore the individual commits brought in to your history by such a merge.

这篇关于清理主分支,但也有中间提交的详细记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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