我该如何打印当前分支以外的其他分支的日志? [英] How can I print the log for a branch other than the current one?

查看:175
本文介绍了我该如何打印当前分支以外的其他分支的日志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在进行一些更改。更改分支是很痛苦的事情,因为某些文件已被进程锁定,因此要更改分支,我必须先停止所有有锁的进程,然后在注销之前先 stash 进行更改



是否有可能查看其他分支的日志而不必将其检出?

解决方案

TL; DR


使用

  git log< branch> 

其中< branch> 是分支的名称


git-log 手册页...


简化中给出的 git-log 简介的版本该命令的手册页

  git log [<修订范围>] 

进一步,您可以找到以下段落:


如果没有< ; revision range> 被指定,默认为 HEAD (即导致当前提交的整个历史记录)


换句话说, git log 等效于 git log HEAD 。例如,如果您在名为 mybranch 的分支上,则此命令也等效于 git log mybranch 。 / p>

您希望将日志限制为可以从另一个分支(即您当前不在的分支)访问的提交。最简单的方法是将感兴趣的分支的名称显式传递给 git log

  git log< branchname> 

请参见 gitrevisions联机帮助页,详细了解< revision-range> 参数可以采用的多种形式。


I'm on a branch with some changes. Changing branch is a pain as some files are locked by processes, so to change branch I'd have to stop all the processes which have locks, then stash the changes before checking out the other branch to see its log.

Is it possible to view the log for a different branch, without having to check it out?

解决方案

TL;DR

Use

git log <branch>

where <branch> is the name of the branch of interest.

From the git-log man-page...

A simplified version of the git-log synopsis given in that command's man page is

git log [<revision range>]

Further down, you can find the following passage:

When no <revision range> is specified, it defaults to HEAD (i.e. the whole history leading to the current commit)

In others words, git log is equivalent to git log HEAD. If you're on a branch, called mybranch, say, this command is also equivalent to git log mybranch.

You want to limit the log to commits reachable from another branch, i.e. a branch you're not currently on. The easiest way to do that is to explicitly pass the name of the branch of interest to git log:

git log <branchname>

See the gitrevisions manpage for more details about the many forms that the <revision-range> argument can take.

这篇关于我该如何打印当前分支以外的其他分支的日志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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