git - Sourcetree:查看一个分支是否被 merge

标签 git git-merge atlassian-sourcetree sourcetree

我如何知道分支(或提交)是否已 merge 到 SourceTree 中?

当使用 gitk --all 时,它将显示提交(或分支)foo 所有其他分支,其中 foo 已经存在 merge 成.

为了阐明我的意思,截图:圈出的(红色)区域显示了当前提交所属的所有分支。这也可以显示在 SourceTree 中吗?

Screenshot of gitk

最佳答案

相当于在 SourceTree 中运行 gitk --all就是从左上角的下 pull 列表中选择All Branches:

View All Branches in SourceTree

该图显示哪些分支已 merge 到哪里,就像 gitk 一样。

但是,要确切地找出哪些分支已 merge 到当前分支中——即提示从 HEAD可达的分支——从命令行更容易完成,您可以简单地说:

git branch --merged

如果需要,您还可以通过添加 --all 选项在列表中包含远程分支:

git branch --all --merged

找出哪些分支没有被 merge 到当前分支中同样容易:

git branch --no-merged

关于git - Sourcetree:查看一个分支是否被 merge ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34270573/

相关文章:

java - GIT:如何使用cherry-pick在两个分支中提交

git - 如何克隆所有远程分支?

git 将两个分支从一个提交 merge 到 HEAD

git - 为什么使用 SourceTree 的 WSL2 上的 Git 对我来说这么慢?

git - 麻烦取消暂存,删除甚至取消跟踪文件

xcode - 如何解除 Xcode 5 项目的工作副本与死机的 SVN 服务器的关联

c# - Git pull 请求中显示的未更改文件

git - 如何在保留 merge 更改的同时删除 merge 提交?

git - 如何让 git 通过放置 "ours first, then theirs"来解决 merge 冲突

ssh - 在 Sourcetree Windows 中为 Mercurial 存储库启用 SSH 压缩