在PowerShell中为Git分支添加选项卡完成 [英] Add tab completion for Git branches in Powershell
问题描述
当在Git仓库中时,是否可以为分支添加选项卡完成到Powershell?例如:
PS> git checkout ma
TAB
会导致
PS> git checkout master
经过快速搜索之后,类似的东西显然存在,这个怪诞但恰当的命名为posh-git:
http://github.com/dahlbyk/posh-git
一组PowerShell脚本,其中
提供Git / PowerShell集成功能
- 提示Git仓库:Git仓库中的提示可以显示当前分支和状态
文件(添加,修改,
删除) 。
- 选项卡完成:当
ul>
使用git时,为常用命令提供选项卡完成。例如。git ch< tab>
- >
git checkout
用法
请参阅profile.example.ps1,了解您的
如何整合制表符完成项目
和/或git提示到您自己的
配置文件中。您还可以选择是否在
标签扩展中显示
advanced git命令,或者只显示简单/常见
命令。默认很简单。
When inside a Git repository, is it possible to add tab completion for branches to Powershell? For example:
PS> git checkout ma
TAB
would result in
PS> git checkout master
For that to be possible, a git provider for PowerShell would need to exist.
After a quick search, something similar apparently exists, the bizarre but aptly named posh-git:
http://github.com/dahlbyk/posh-git
A set of PowerShell scripts which provide Git/PowerShell integration
- Prompt for Git repositories: The prompt within Git repositories can show the current branch and the state of files (additions, modifications,
deletions) within.- Tab completion: Provides tab completion for common commands when using git. E.g.
git ch<tab>
-->git checkout
Usage
See profile.example.ps1 as to how you can integrate the tab completion and/or git prompt into your own profile. You can also choose whether advanced git commands are shown in the tab expansion or only simple/common commands. Default is simple.
这篇关于在PowerShell中为Git分支添加选项卡完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!