Why doesn't gitk show my local branch?

I learn git and use gitk to visualize my history and branches.

I tried gitk in a locally initialized repo, and it can show both branches, which I did correctly.

However, when I tried to run gitk to visualize the repo obtained with git clone , gitk shows only one of the branches.


Here's what happens:

After I made git clone , I can see 1 branch locally:

 $ git branch * experiment 

So, I created git checkout -b master origin/master to create my local tracking branch:

 $ git branch experiment * master 

Now I thought that I have 2 local branches, so I happily run gitk , however I can only see one branch:

gitk not showing local branch

I know a way to view the hidden master branch by running gitk --all :

gitk only show other local branch when use with --all

But now I'm really curious why gitk not showing the local master branch that I have, does anyone have any ideas?

Thanks!

+4
source share
1 answer

Gitk by default only shows the branch you are in.

It seems that when you started gitk, your current branch was an experiment. Therefore, gitk only showed you the commits that lie on the experiment branch. This is gitk's default behavior because when you have many branches, the branch names can be quite distracting.

gitk --all tells gitk to show all branches. At that moment, git showed you the master.

You can create all kinds of views in gitk, and you can run it to use a predefined view. Place an order in the "Edit View" menu.

+11
source

Source: https://habr.com/ru/post/1401515/


All Articles