bash - 如何在 WSL 中显示当前分支(我使用 Vscode)
问题描述
我使用 Vscode,我想知道我的 HEAD 指向的分支在哪里,
如何显示当前的分支名称,如 Bash?
我在我的 Vscode 中使用 WSL(ubuntu)termimal,操作系统是 Windows 10
谢谢
解决方案
请注意,从microsoft/vscode
issue 67670 开始,当前分支名称已经在 VSCode 的状态栏中可见。
或者,使用 Git 2.22+(2019 年第二季度)
git branch --show-current
确实,VSCode 中的 git bash 中的提示不显示 Git 分支。
您需要配置$SHELL
例如,要启用将 bash 作为登录 shell(运行
.bash_profile
)运行,请传入-l
参数(带双引号):
// Linux
"terminal.integrated.shellArgs.linux": ["-l"]
然后在你~/.bashrc
可以包括一个特殊的提示。
推荐阅读
- google-apps-script - 如何通过 AppsScript 在 Google Sheet 中返回函数
- reactjs - 带有过滤器的数字输入反应
- android - 我的 Unity 登录可以连接到与我的 Android Studio 登录相同的数据库吗?
- android - 通过 USB 部署 Xamarin Forms 应用程序引发异常
- android - 图库选择器在 Android 10 上返回带有文件方案的 Uri,如何读取它?
- postman - 邮递员:如何多次重新运行邮递员请求的子集
- maven-3 - Jacoco index HTML 不显示所有模块
- c# - 为相同类型序列化不同的小数点分隔符
- c# - 在c#中如何计算单个字符串中的数字
- c# - 使用 C# 在 CosmosDB 中查询 SQL API