Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/visual-studio-code/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio code 在VisualStudio代码中显示git分支_Visual Studio Code - Fatal编程技术网

Visual studio code 在VisualStudio代码中显示git分支

Visual studio code 在VisualStudio代码中显示git分支,visual-studio-code,Visual Studio Code,我有这样一个项目文件夹结构:code/Repo/..subfolders,在中我有一个隐藏的.git文件夹,因为我从Sourcetree克隆到了这个文件夹 Eclipse确实显示了当前分支,但当我在VisualStudio代码中打开此文件夹时,我知道它必须在左下方显示当前分支名称 有人知道怎么做吗?要在Visual Studio代码中显示分支名称 多谢各位 -->我将Sourcetree的bin文件夹添加到路径中,现在一切正常:D。Sourcetree使用embed git,因此您必须将其添加到

我有这样一个项目文件夹结构:
code/Repo/..subfolders
,在
中我有一个隐藏的
.git
文件夹,因为我从Sourcetree克隆到了这个文件夹

Eclipse确实显示了当前分支,但当我在VisualStudio代码中打开此文件夹时,我知道它必须在左下方显示当前分支名称

有人知道怎么做吗?要在Visual Studio代码中显示分支名称

多谢各位

-->我将Sourcetree的bin文件夹添加到路径中,现在一切正常:D。Sourcetree使用embed git,因此您必须将其添加到窗口路径中,它表示:

注意:VS代码将利用计算机的Git安装,因此 在获得这些功能之前,需要先安装Git。确保你 至少安装2.0.0版


因此,您的系统上需要有Git才能正常工作。从Sourcetree安装中使用嵌入式Git可能会起作用,但可能不是最干净的解决方案。我的Sourcetree安装(在Mac上)中的Git大约有3年历史(2.2.1)。在Mac电脑上也预装了Git(2.11.0),所以在这里它是开箱即用的。

假设你已经安装了Git,你所要做的就是转到
查看
->
显示状态栏
(如下所示)。然后,它将在当前编辑器窗口的底部显示当前分支


对于windows: 最简单的方法是将集成终端外壳从Powershell更改为Git Bash。您可以通过转到文件>首选项>设置并更改集成终端外壳来完成此操作,如下图所示:

对于mac,导航到:
代码>首选项>设置>搜索“终端”

如果您还想在可视代码终端窗口中显示工作分支,请尝试从Chocolate安装posh git,您将获得所有git summarycolor编码和选项卡完成,分支名称以高亮显示的颜色显示。如果您运行的Powershell版本低于6,请确保将执行策略设置为高于限制。

如果找到答案,最好将其作为此问题的答案,以便对其他人有用:)好主意,也可以在普通powershell终端窗口中更改此设置。可能还需要右键单击状态并选中“源代码管理”。