查看 Git 分支是否已经合并, 有什么好办法?
天蓬老师
天蓬老师 2017-04-24 16:00:56
0
4
1156

多人开发使用了较多分支, 有些还没觉得及时清理, 结果积累下来不少,
有些比较容易看出来手动删掉, 有些就不大清楚了...
往 commit history 里看会比较麻烦, 有没有比较方便查看的办法?

另外合并的话, 有时候合的是 git merge branch-a,
有时候合并会是 git merge origin/branch-a,
查看是否合并是否可以不受这个区别的影响?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(4)
为情所困

Try:
- git branch --merged
- git branch --no-merged

PHPzhong

You can also try git log | grep branch_name

世界只因有你

Recommend a tool tig
The effect is as follows:

Capital M 代表的就是 merge 操作,这样看应该很清晰吧,每个分支的历史都可以看得清清楚楚,当然号称 git 浏览器的 tig does more than that, it has many more powerful features and is worth using.

某草草

If the branch is explicitly merged, just git branch -d xxx will do. If merge is not displayed, this command will not be executed.

But some branches may be implicitly merged, that is, their code is merged into the trunk (merge --squash/rebase), but no explicit merge is performed. What should I do in this case? For example, this branch is called feature, and the trunk is master

git checkout feature
git rebase master(以master为基 rebase)
解决下冲突
这时候feature分支就是以master HEAD为基的分支了,之后是merge还是丢弃随你便。。
当然rebase后发现feature和master 指向同一个HEAD,那么这个分支肯定是合并过的,直接-d删掉即可
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template