为什么gitk不显示我的本地分支? [英] Why is gitk not showing my local branch?

查看:168
本文介绍了为什么gitk不显示我的本地分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 git ,并使用 gitk 来显示我的历史记录和分支。



我在本地初始化的仓库上试过 gitk ,并且它能够显示我正确设置的两个分支。



然而,当我尝试启动 gitk 来可视化使用 git clone gitk 只显示其中一个分支。






这是发生的事情:

git clone ,我可以在本地看到1个分支:

  $ git分支
* experiment

所以我做了 git checkout -b master master origin / master> 创建我的本地跟踪分支,现在:

  $ git分支
实验
* master

现在我想我有2个本地分支机构,所以我很高兴地推出 gitk ,但是,我只能看到一个分支:



我知道一种查看隐藏的 master 执行 gitk --all





但现在我真的很好奇,为什么 gitk 没有显示本地的


$ b

谢谢!

我在这里有一个分支,有没有人有任何想法? =h2_lin>解决方案

默认情况下,Gitk只显示您所在的分支。



看起来,当您启动gitk时,目前的分支是实验。因此,gitk只向你展示了位于实验分支上的提交。这是gitk默认行为的方式,因为一旦你有很多分支,分支名称实际上可能会让人分心。

gitk --all 告诉gitk显示所有分支。在这一点上,gitk向您展示了主人。



您可以在gitk中创建各种视图,并启动它以使用预定义的视图。检出编辑视图菜单项。

I'm learning about git and is using gitk to visualize my history and branches.

I tried gitk on a locally initialized repo, and it is able to show both branches that I made properly.

However, when I tried to launch gitk to visualize a repo obtained using git clone, gitk only shows one of the branches.


This is what happen:

After I did a git clone, I can see 1 branch locally:

$ git branch
* experiment

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

$ git branch
  experiment
* master

Now I thought I'm having 2 local branches, so I happily launch gitk, however, I can only see one branch:

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

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

Thanks!

解决方案

Gitk by default only shows you the branch you are on.

It seems that when you launched gitk, your current branch was experiment. Therefore, gitk only showed you commits that lie on the experiment branch. This is the way gitk behaves by default because once you have a lot of branches, the branch names can actually be quite distracting.

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

You can create all kinds of views in gitk and you can launch it to use a pre-defined view. Checkout the "Edit View" menu entry.

这篇关于为什么gitk不显示我的本地分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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