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
gitkcommand. I'm assuming that you're already using--all, but you might be interested to know that there's also a--notflag...although it has some side effects and is not too useful in most circumstances.Consider a repository that looks like this:
If you specify no arguments, you get just the branch you're on:
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 mergedfeature-Aandmaster, but nofeature-D:Finally, you can use the
--notflag to ignore a branch. However, since a branch refers to all the commits that lead up to it, the--notflag will ignore commits that are on the branches that you do specify.Both of these will give you:
Here, the commits
Initial commitand1are ignored, because they belonged to branchfeature-D. Commit2is also ignored for the same reason, but is shown as an empty commit, since it would be incorrect and misleading to show commit3as the initial commit in the branch. This flag can be helpful sometimes, but I don't usually find myself using it.