2. Git 基礎
3. 使用 Git 分支
4. 伺服器上的 Git
5. 分散式的 Git
7. Git Tools
10. Git Internals
A1.6 附錄 A: Git in Other Environments - Git in Powershell
Git in Powershell
The standard command-line terminal on Windows (
cmd.exe) isn’t really capable of a customized Git experience, but if you’re using Powershell, you’re in luck.
A package called Posh-Git (https://github.com/dahlbyk/posh-git) provides powerful tab-completion facilities, as well as an enhanced prompt to help you stay on top of your repository status.
It looks like this:
If you’ve installed GitHub for Windows, Posh-Git is included by default, and all you have to do is add these lines to your
profile.ps1 (which is usually located in
. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") . $env:github_posh_git\profile.example.ps1
If you’re not a GitHub for Windows user, just download a Posh-Git release from (https://github.com/dahlbyk/posh-git), and uncompress it to the
Then open a Powershell prompt as the administrator, and do this:
> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm > cd ~\Documents\WindowsPowerShell\posh-git > .\install.ps1
This will add the proper line to your
profile.ps1 file, and posh-git will be active the next time you open your prompt.