Reputation: 6074
How to make gitk show only local branches? Or even better - can I hide remote branches that do not have corresponding local branches?
Upvotes: 15
Views: 5079
Reputation: 594
gitk --branches
It corresponds to going into "view" and checking "All (local) branches"
Upvotes: 3
Reputation: 181
You can create a new "View" that shows only local branches like this:
Now, you should see a "Local Branches" option in the View menu. Choosing this view will only show commits present in local branches. Note that you may still see remote branch labels, but only if the commit they point to is in a local branch.
Upvotes: 18
Reputation: 313
Since I found this question in a search, the accepted answer didn't work for me, and I eventually found a solution that did, I figured I'd share:
gitk --argscmd='git for-each-ref --format="%(refname)" refs/heads'
It will even update if you add a branch and then refresh a running gitk with F5. You can include tags as well with:
gitk --argscmd='git for-each-ref --format="%(refname)" refs/heads refs/tags'
Or using rev-list (shorter, but slightly cheating):
gitk --argscmd='git rev-list --no-walk --branches --tags'
Upvotes: 9
Reputation: 6074
After some experimenting I have found a solution. The following command works:
echo $(git branch) | gitk
It shows only those remote branches that have corresponding local branches. It is important to use echo $(git branch)
since it forces branch
to return raw list of branches instead of formatted output such as the following:
$ git branch
develop
release-M4.1
vendor
* xflow
Upvotes: -2