网站建设意思,惠州做学校网站,携程网站用js怎么做,服务器搭建网站数据库文章目录 1. PowerShell 里的 git 默认使用体验不够好2. posh-git 介绍2.1 安装 posh-git2.2 PS1 显示的内容2.3 补全分支 1. PowerShell 里的 git 默认使用体验不够好
在 Windows 系统上#xff0c;安装了 git for windows 后#xff0c; git bash 里的体验确实不错。 但是… 文章目录 1. PowerShell 里的 git 默认使用体验不够好2. posh-git 介绍2.1 安装 posh-git2.2 PS1 显示的内容2.3 补全分支 1. PowerShell 里的 git 默认使用体验不够好
在 Windows 系统上安装了 git for windows 后 git bash 里的体验确实不错。 但是在 Windows11 系统里使用 PowerShell 的时候是非常多的例如 VSCode 里按下 Ctr 快捷键后 弹出的终端默认是 PowerShell。
PowerShell 中的 git 缺少一些很好用的特性
命令补全例如输入 git checkout 的时候 输入 git che 后按下 tab 键希望补全为 git checkout.分支补全例如当前在 dev 分支 想要切换回到 main 分支 当输入 git switch ma 后 按下了 tab 键希望补全为 git checkout main显示当前的分支名字类似于 oh-my-zsh 那样在 $PS1 变量里标注
2. posh-git 介绍
posh-git 官方是 https://github.com/dahlbyk/posh-git
在 Pro Git 在线电子书中提到了 posh-git https://git-scm.com/book/zh/v2/附录-A%3A-在其它环境中使用-Git-Git-在-PowerShell-中使用-Git 2.1 安装 posh-git
管理员权限开启 PowerShell 后 安装 posh-git 模块
PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force任意一个 PowerShell 窗口 加载 posh-git 模块
Import-Module posh-git也可以让 powershell 每次开启时自动加载 posh-git 模块方法是
Add-PoshGitToProfile不过这个配置会让 PowerShell 每次加载消耗1秒多 建议不设置需要的时候临时输入 Import-Module posh-git。
2.2 PS1 显示的内容
例如 ncnn 本地仓库落后于remote多个commit
2.3 补全分支
例如打算切换到 azure-pipelines 分支当输入完 azure 后按下 Tab 会自动补全为 azure-pipelines