我有一个本地分支跟踪远程/主分支。在运行git-pull和git-log之后,日志将显示远程跟踪分支和当前分支中的所有提交。但是,由于对远程分支进行了如此多的更改,所以我只需要查看提交到当前本地分支的情况。

要使用什么Git命令来只显示特定分支的提交?

注:

配置信息:

[branch "my-branch"]
  remote = origin
  merge = refs/heads/master

当前回答

git log $(git branch --show-current)

其他回答

运行git log origin/$BRANCH_NAME即可

Use:

git log --graph --abbrev-commit --decorate  --first-parent <branch_name>

它只针对目标分支(当然——graph,——abbrev-commit——装饰都比较抛光)。

关键选项是——first-parent:“在看到合并提交时只遵循第一个父提交”(https://git-scm.com/docs/git-log)

它可以防止显示提交叉。

这是一个狡猾的新时代GUI的答案,但无论如何,在Xcode中显然有一个可视化工具。

如果您只想要那些在特定分支中由您完成的提交,请使用下面的命令。

git log branch_name --author='Dyaniyal'
git log $(git branch --show-current)