有什么办法可以排除在GitK中显示的分支? [英] Is there any way to exclude branches from showing in GitK?

查看:604
本文介绍了有什么办法可以排除在GitK中显示的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时当我使用GitK时,我不关心分支上的一些提交,他们倾向于阻碍我正在做的事情。



这是很好的,能够指定我想要的分支,或指定我想排除哪些分支。



这可能吗?

解决方案

通过指定 gitk 命令的参数,您可以指定您想要的分支。我假设你已经在使用 - all ,但你可能有兴趣知道还有一个 - 不是 flag ...虽然它有一些副作用,但在大多数情况下并不是很有用。



考虑一个如下所示的存储库:

  git checkout feature-B 
gitk --all



如果你没有指定参数,你只需要你所在的分支:

  gitk 


如果你指定多个分支,你会得到那些分支和完全合并的分支(即它们不会伸出 )。例如,在这里我有 feature-B feature-C ,以及完全合并的 feature-A master ,但没有 feature-D

  gitk feature-B feature-C 



最后,您可以使用 - 而不是标志来忽略分支。 然而,因为一个分支引用了所有提交给它的提交, - not 标志将忽略分支上的提交

  gitk特征-B不是特征-D 
gitk - all - not-D feature-C

这两个都会给你: p>



在这里,提交初始提交 1 被忽略,因为它们属于分支特征d 。由于相同的原因,提交 2 也被忽略,但是显示为空提交,因为显示commit 3 作为分支中的初始提交。此标志有时可能会有所帮助,但我通常不会使用它。


Sometimes when I use GitK there's a load of commits on branches I'm not concerned with and they tend get in the way of what I'm doing.

It would be nice to be able to specify which branches I want, or specify which branches I want to exclude.

Is this possible?

解决方案

You can specify which branches you want by specifying them as arguments to the gitk command. I'm assuming that you're already using --all, but you might be interested to know that there's also a --not flag...although it has some side effects and is not too useful in most circumstances.

Consider a repository that looks like this:

git checkout feature-B
gitk --all

If you specify no arguments, you get just the branch you're on:

gitk

If you specify multiple branches, you get those branches, and the branches that are fully merged (i.e. they don't "stick out"). For example, here I have feature-B, feature-C, along with the fully merged feature-A and master, but no feature-D:

gitk feature-B feature-C

Finally, you can use the --not flag to ignore a branch. However, since a branch refers to all the commits that lead up to it, the --not flag will ignore commits that are on the branches that you do specify.

gitk feature-B --not feature-D
gitk --all --not feature-D feature-C

Both of these will give you:

Here, the commits Initial commit and 1 are ignored, because they belonged to branch feature-D. Commit 2 is also ignored for the same reason, but is shown as an empty commit, since it would be incorrect and misleading to show commit 3 as the initial commit in the branch. This flag can be helpful sometimes, but I don't usually find myself using it.

这篇关于有什么办法可以排除在GitK中显示的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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