Skip to content

Translate A-git-in-other-environments powershell #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 3, 2015
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions book/A-git-in-other-environments/sections/powershell.asc
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
[[_git_powershell]]
=== Git in Powershell
=== Powershell 中的 Git

(((powershell)))(((tab completion, powershell)))(((shell prompts, powershell)))
(((posh-git)))
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:
Windows 中的普通命令行终端 (`cmd.exe`) 无法自定义 Git 使用体验,但是如果你正在使用 Powershell 那么你就十分幸运了。
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

但是如果你正在使用 Powershell,那么你就十分幸运了。

一个名为 Posh-Git (https://github.com/dahlbyk/posh-git[]) 的扩展包提供了强大的 tab 补全功能, 并针对提示符进行了增强,以帮助你聚焦于你的仓库状态。它看起来像:

.Powershell with Posh-git.
image::images/posh-git.png[Powershell with Posh-git.]
.附带了 Posh-Git 扩展包的 Powershell。
image::images/posh-git.png[附带了 Posh-Git 扩展包的 Powershell。]

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 `C:\Users\<username>\Documents\WindowsPowerShell`):
如果你已经在 Windows 上安装了 GitHubPosh-Git 会被默认包含进来,你只需要添加以下两行到你的 `profile.ps1` 文件 (文件位于 `C:\Users\<username>\Documents\WindowsPowerShell`):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

会被默认包含进来——也会被安装
这里没必要一个词一个词直译


[source,powershell]
-----
. (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 `WindowsPowershell` directory.
Then open a Powershell prompt as the administrator, and do this:
如果你没有在 Windows 上安装 GitHub,只需要从 (https://github.com/dahlbyk/posh-git[]) 下载一份 Posh-Git 发行版,并且解压至 `WindowsPowershell` 目录。
然后以管理员权限打开 Powershell 提示符,并且执行下面的命令:

[source,powershell]
-----
Expand All @@ -27,4 +27,4 @@ Then open a Powershell prompt as the administrator, and do this:
> .\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.
它将会向你的 `profile.ps1` 文件添加适当的内容,Posh-Git 将会在下次打开提示符时被启用。
2 changes: 1 addition & 1 deletion status.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
"sections/bash.asc": 0,
"sections/eclipse.asc": 0,
"sections/guis.asc": 100,
"sections/powershell.asc": 0,
"sections/powershell.asc": 100,
"sections/visualstudio.asc": 0,
"sections/zsh.asc": 0
},
Expand Down