首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Git将主服务器合并为分支提交顺序

Git将主服务器合并为分支提交顺序
EN

Stack Overflow用户
提问于 2016-10-19 19:10:10
回答 1查看 123关注 0票数 2

我有一个GIT主分支,它有以下提交

代码语言:javascript
复制
Master:-
      commit one
      commit two

现在,我创建了一个新的分支sprint1,并添加了以下内容

代码语言:javascript
复制
Sprint1:
      commit one
      commit two
      commit sprint1 one

THe主人和sprint1在这一点上有分歧。

代码语言:javascript
复制
Master:
      commit one
      commit two
      commit three

Sprint1:
      commit one
      commit two
      commit sprint1 one
      commit sprint1 two
      commit sprint1 three

现在,当我将主人合并到sprint1中时,我得到以下信息:

代码语言:javascript
复制
Sprint1
      commit one
      commit two
      commit sprint1 one
      commit three
      commit sprint1 two
      commit sprint1 three
      commit merged commit

但是,当我将主人合并到sprint1中时,我期望这样做:

代码语言:javascript
复制
Sprint1
      commit one
      commit two
      commit sprint1 one
      commit sprint1 two
      commit sprint1 three
      commit three
      commit merged commit

如何是前者而不是后者。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-10-19 19:52:45

根据文档,提交按反向时间顺序显示。

要按照您期望的顺序获得提交,请尝试使用:

代码语言:javascript
复制
git log --oneline --topo-order

这避免了在混合的多行历史上显示提交。

有关详细信息,请参阅:ordering

您还可以使用--graph作为一个更好的输出,分支单独显示。默认情况下,这意味着使用--topo-order选项。

我有时更喜欢使用别名的快速日志版本是:

代码语言:javascript
复制
git --no-pager log --decorate=short --pretty=oneline --abbrev-commit --graph -n 10
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/40139657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档