bash - 如何在 WSL 中显示当前分支(我使用 Vscode)

标签 bash git visual-studio-code windows-subsystem-for-linux

我使用Vscode,我想知道我的HEAD指向的分支在哪里,
如何显示当前的分支名称,如 Bash?
我在我的 Vscode 中使用 WSL(ubuntu)termimal,操作系统是 Windows 10

谢谢

WSL image

最佳答案

请注意,来自 microsoft/vscode issue 67670 ,当前分支名称已经在 VSCode 的状态栏中可见。

branch VSCode

或者,with Git 2.22+ (2019 年第二季度)

git branch --show-current

prompt in a git bash in VSCode does not display the Git branch 是真的.

您需要 configure the $SHELL

For example, to enable running bash as a login shell (which runs .bash_profile), pass in the -l argument (with double quotes):

// Linux
"terminal.integrated.shellArgs.linux": ["-l"]

然后在你的~/.bashrc 中可以include a special prompt .

关于bash - 如何在 WSL 中显示当前分支(我使用 Vscode),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62587050/

相关文章:

linux - BASH:找到字符串并打印上面的所有相关注释

python - 从 Python 脚本执行 shell 命令

Git with Cygwin - 不接受用户名的用户输入

linux - 在同一行的两个位置使用 sed 或 awk 从多行中删除模式

regex - 带有复杂分隔符的 Linux grep 命令

git - npm install 权限被拒绝错误

node.js - 源代码控制 (git) docker-compose.yml

visual-studio-code - 不用 ctrl+space 自动完成

visual-studio-code - 从 VSCode 启动 Windows 终端?

python - DLL 加载失败 : The specific module could not be found (VSCode, Numpy)