gpt4 book ai didi

git log 只返回对主分支所做的提交?

转载 作者:IT王子 更新时间:2023-10-29 01:03:35 26 4
gpt4 key购买 nike

我做了一些搜索并发现:

git log myBranchName

作为一个可能的解决方案。但是当我的分支是 master 分支时会发生什么?当我运行时:

git log master

它似乎返回了提交给任何分支的所有内容。根据我阅读的内容,它列出了与 master 分支相关的所有提交。知道了,怎么才能只调出master分支的提交历史呢?

最佳答案

我想这就是你想要的

git log --first-parent master

引用手册

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.

关于git log 只返回对主分支所做的提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15875253/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com