diff --git a/A-git-in-other-environments.asc b/A-git-in-other-environments.asc index 8d3f9d5b..f788442c 100644 --- a/A-git-in-other-environments.asc +++ b/A-git-in-other-environments.asc @@ -1,4 +1,4 @@ -[#A-git-in-other-environments] +[[A-git-in-other-environments]] [appendix] ////////////////////////// == Git in Other Environments @@ -20,8 +20,14 @@ include::book/A-git-in-other-environments/sections/guis.asc[] include::book/A-git-in-other-environments/sections/visualstudio.asc[] +include::book/A-git-in-other-environments/sections/visualstudiocode.asc[] + include::book/A-git-in-other-environments/sections/eclipse.asc[] +include::book/A-git-in-other-environments/sections/jetbrainsides.asc[] + +include::book/A-git-in-other-environments/sections/sublimetext.asc[] + include::book/A-git-in-other-environments/sections/bash.asc[] include::book/A-git-in-other-environments/sections/zsh.asc[] diff --git a/book/06-github/sections/2-contributing.asc b/book/06-github/sections/2-contributing.asc index b44439c1..4fbf3d93 100644 --- a/book/06-github/sections/2-contributing.asc +++ b/book/06-github/sections/2-contributing.asc @@ -65,7 +65,7 @@ After a few seconds, you'll be taken to your new project page, with your own wri ////////////////////////// 数秒後、新しいプロジェクトのページに自動的に移動します。これは、あなた自身が書き込み可能なコピーです。 -[[r_github_flow]] +[[ch06-github_flow]] ////////////////////////// ==== The GitHub Flow ////////////////////////// diff --git a/book/06-github/sections/3-maintaining.asc b/book/06-github/sections/3-maintaining.asc index cc376780..5b7636dd 100644 --- a/book/06-github/sections/3-maintaining.asc +++ b/book/06-github/sections/3-maintaining.asc @@ -218,10 +218,10 @@ $ curl http://github.com/tonychacon/fade/pull/1.patch | git am ===== プルリクエスト上での共同作業 ////////////////////////// -As we covered in <>, you can now have a conversation with the person who opened the Pull Request. +As we covered in <>, you can now have a conversation with the person who opened the Pull Request. You can comment on specific lines of code, comment on whole commits or comment on the entire Pull Request itself, using GitHub Flavored Markdown everywhere. ////////////////////////// -<> で説明したとおり、プルリクエストの作者とのやりとりができるようになりました。 +<> で説明したとおり、プルリクエストの作者とのやりとりができるようになりました。 コードの特定の行にコメントをしたり、コミット全体やプルリクエストそのものに対してコメントしたりすることができ、 その際には GitHub Flavored Markdown が使えます。 diff --git a/book/A-git-in-other-environments/sections/bash.asc b/book/A-git-in-other-environments/sections/bash.asc index f212dc0a..b65ae4ac 100644 --- a/book/A-git-in-other-environments/sections/bash.asc +++ b/book/A-git-in-other-environments/sections/bash.asc @@ -19,14 +19,14 @@ Copy it somewhere handy, like your home directory, and add this to your `.bashrc 取得したファイルをどこか適当な場所(例えばホームディレクトリ)へコピーした上で、 `.bashrc` に次の内容を追加します。 [source,console] ------ +---- . ~/git-completion.bash ------ +---- ////////////////////////// -Once that's done, change your directory to a git repository, and type: +Once that's done, change your directory to a Git repository, and type: ////////////////////////// -設定が完了したら、カレントディレクトリをgitリポジトリに変更し、次のようにタイプしてみてください。 +設定が完了したら、カレントディレクトリをGitリポジトリに変更し、次のようにタイプしてみてください。 [source,console] ---- @@ -50,11 +50,11 @@ To add these to your prompt, just copy the `contrib/completion/git-prompt.sh` fi プロンプトにこれらを追加するには、Gitのソースリポジトリから `contrib/completion/git-prompt.sh` ファイルをあなたのホームディレクトリにコピーし、次のような内容を `.bashrc` に追加します。 [source,console] ------ +---- . ~/git-prompt.sh export GIT_PS1_SHOWDIRTYSTATE=1 export PS1='\w$(__git_ps1 " (%s)")\$ ' ------ +---- ////////////////////////// The `\w` means print the current working directory, the `\$` prints the `$` part of the prompt, and `__git_ps1 " (%s)"` calls the function provided by `git-prompt.sh` with a formatting argument. diff --git a/book/A-git-in-other-environments/sections/guis.asc b/book/A-git-in-other-environments/sections/guis.asc index 026a964f..730a1e55 100644 --- a/book/A-git-in-other-environments/sections/guis.asc +++ b/book/A-git-in-other-environments/sections/guis.asc @@ -74,8 +74,8 @@ Gitkのインターフェイスは次のようになっています。 .The `gitk` history viewer. image::images/gitk.png[The `gitk` history viewer.] ////////////////////////// -.`gitk`の歴史ビューアー -image::images/gitk.png[`gitk`の歴史ビューアー] +.`gitk` の歴史ビューアー +image::images/gitk.png[`gitk` の歴史ビューアー] ////////////////////////// On the top is something that looks a bit like the output of `git log --graph`; each dot represents a commit, the lines represent parent relationships, and refs are shown as colored boxes. @@ -96,9 +96,9 @@ It, too, is easiest to invoke from the command line: これも、コマンドラインから起動するのが最も簡単です。 [source,console] ------ +---- $ git gui ------ +---- ////////////////////////// And it looks something like this: @@ -145,17 +145,17 @@ Each of them is tailored for a specific purpose (viewing history and creating co ////////////////////////// -==== GitHub for Mac and Windows +==== GitHub for macOS and Windows ////////////////////////// -==== MacとWindows用のGitHubクライアント +==== macOSとWindows用のGitHubクライアント -(((GitHub for Mac)))(((GitHub for Windows))) +(((GitHub for macOS)))(((GitHub for Windows))) ////////////////////////// -GitHub has created two workflow-oriented Git clients: one for Windows, and one for Mac. +GitHub has created two workflow-oriented Git clients: one for Windows, and one for macOS. These clients are a good example of workflow-oriented tools – rather than expose _all_ of Git's functionality, they instead focus on a curated set of commonly-used features that work well together. They look like this: ////////////////////////// -GitHubは、ワークフロー指向のGitクライアントを公開しています。Windows用クライアントと、Mac用クライアントがあります。 +GitHubは、ワークフロー指向のGitクライアントを公開しています。Windows用クライアントと、macOS用クライアントがあります。 これらのクライアントは、ワークフロー指向のツールの良い例です。Gitの機能の _すべて_ を公開するのではなく、よく使われる機能の中から一緒に使うと便利な機能を選択し、それにフォーカスしています。 表示内容は次のようになっています。 @@ -167,13 +167,15 @@ image::images/github_mac.png[GitHub for Mac.] image::images/github_mac.png[GitHubのMac用クライアント] ////////////////////////// -.GitHub for Windows. -image::images/github_win.png[GitHub for Windows.] +.GitHub for macOS. +image::images/github_mac.png[GitHub for macOS.] ////////////////////////// .GitHubのWindows用クライアント image::images/github_win.png[GitHubのWindows用クライアント] ////////////////////////// +.GitHub for Windows. +image::images/github_win.png[GitHub for Windows.] They are designed to look and work very much alike, so we'll treat them like a single product in this chapter. We won't be doing a detailed rundown of these tools (they have their own documentation), but a quick tour of the ``changes'' view (which is where you'll spend most of your time) is in order. ////////////////////////// @@ -183,13 +185,13 @@ We won't be doing a detailed rundown of these tools (they have their own documen ////////////////////////// * On the left is the list of repositories the client is tracking; you can add a repository (either by cloning or attaching locally) by clicking the ``+'' icon at the top of this area. * In the center is a commit-input area, which lets you input a commit message, and select which files should be included. - (On Windows, the commit history is displayed directly below this; on Mac, it's on a separate tab.) + (On Windows, the commit history is displayed directly below this; on macOS, it's on a separate tab.) * On the right is a diff view, which shows what's changed in your working directory, or which changes were included in the selected commit. * The last thing to notice is the ``Sync'' button at the top-right, which is the primary way you interact over the network. ////////////////////////// * 左側には、クライアントが追跡しているリポジトリのリストが表示されます。この領域の一番上の ``+ '' アイコンをクリックすると、(ローカルでクローンするかアタッチするかして)リポジトリを追加できます。 * 真ん中はコミット入力領域です。コミットメッセージを入力したり、コミットに含めるファイルを選択したりできます。 - (Windowsでは、コミットの歴史は、この下に直接表示されます。Macの場合は、別のタブに表示されます。) + (Windowsでは、コミットの歴史は、この下に直接表示されます。macOSの場合は、別のタブに表示されます。) * 右側はdiffビューです。作業ディレクトリの変更内容、または、選択しているコミットに含まれている内容が表示されます。 * 最後に、右上の ``Sync'' ボタンは、ネットワーク経由で対話を行う主要な手段です。 @@ -212,16 +214,16 @@ While they're designed to highlight GitHub's service and recommended workflow, t ===== インストール ////////////////////////// -GitHub for Windows can be downloaded from https://windows.github.com[], and GitHub for Mac from https://mac.github.com[]. +GitHub for Windows can be downloaded from https://windows.github.com[], and GitHub for macOS from https://mac.github.com[]. When the applications are first run, they walk you through all the first-time Git setup, such as configuring your name and email address, and both set up sane defaults for many common configuration options, such as credential caches and CRLF behavior. ////////////////////////// -Windows用のGitHubクライアントは https://windows.github.com[] から、Mac用のGitHubクライアントは https://mac.github.com[] からダウンロードできます。 +Windows用のGitHubクライアントは https://windows.github.com[] から、macOS用のGitHubクライアントは https://mac.github.com[] からダウンロードできます。 クライアントを初めて実行する際には、名前やメールアドレスの設定といったGitの初期設定がひと通り行われます。また、認証情報のキャッシュやCRLFの挙動といった、一般的なオプション設定に対して、デフォルト値が設定されます。 ////////////////////////// Both are ``evergreen'' – updates are downloaded and installed in the background while the applications are open. This helpfully includes a bundled version of Git, which means you probably won't have to worry about manually updating it again. -On Windows, the client includes a shortcut to launch Powershell with Posh-git, which we'll talk more about later in this chapter. +On Windows, the client includes a shortcut to launch PowerShell with Posh-git, which we'll talk more about later in this chapter. ////////////////////////// これらのツールはいずれも ``新鮮'' な状態に保たれます。つまり、アプリケーションのアップデートは、アプリケーションの実行中にバックグラウンドで自動的にダウンロードされ、インストールされます。 このアップデートには、ツールに同梱されているGitも含まれています。そのため、Gitを手動で更新する心配をする必要はおそらくないと思います。 @@ -244,25 +246,25 @@ If you already have a local repository, just drag its directory from the Finder ////////////////////////// Once it's installed and configured, you can use the GitHub client for many common Git tasks. The intended workflow for this tool is sometimes called the ``GitHub Flow.'' -We cover this in more detail in <>, but the general gist is that (a) you'll be committing to a branch, and (b) you'll be syncing up with a remote repository fairly regularly. +We cover this in more detail in <>, but the general gist is that (a) you'll be committing to a branch, and (b) you'll be syncing up with a remote repository fairly regularly. ////////////////////////// インストールと設定が完了したら、GitHubクライアントを使って一般的なGitのタスクの多くが行えます。 このツールで想定されているワークフローは ``GitHub Flow'' とも呼ばれています。 -この詳細は <> で取り上げます。要点としては、(a)コミットはブランチに対して行う、(b)定期的にリモートリポジトリと同期する、といった点があります。 +この詳細は <> で取り上げます。要点としては、(a)コミットはブランチに対して行う、(b)定期的にリモートリポジトリと同期する、といった点があります。 ////////////////////////// Branch management is one of the areas where the two tools diverge. -On Mac, there's a button at the top of the window for creating a new branch: +On macOS, there's a button at the top of the window for creating a new branch: ////////////////////////// ブランチ管理は、2つのツールで操作が異なる点の一つです。 -Mac用クライアントでは、新しいブランチを作成するためのボタンがウィンドウ上部にあります。 +macOS用クライアントでは、新しいブランチを作成するためのボタンがウィンドウ上部にあります。 ////////////////////////// -.``Create Branch'' button on Mac. -image::images/branch_widget_mac.png[``Create Branch'' button on Mac.] +.``Create Branch'' button on macOS. +image::images/branch_widget_mac.png[``Create Branch'' button on macOS.] ////////////////////////// -.Mac用クライアントの ``Create Branch'' ボタン -image::images/branch_widget_mac.png[Mac用クライアントの ``Create Branch'' ボタン] +.macOS用クライアントの ``Create Branch'' ボタン +image::images/branch_widget_mac.png[macOS用クライアントの ``Create Branch'' ボタン] ////////////////////////// On Windows, this is done by typing the new branch's name in the branch-switching widget: @@ -330,9 +332,9 @@ However, if your workflow is different, or you want more control over how and wh ////////////////////////// There are a number of other graphical Git clients, and they run the gamut from specialized, single-purpose tools all the way to apps that try to expose everything Git can do. -The official Git website has a curated list of the most popular clients at http://git-scm.com/downloads/guis[]. +The official Git website has a curated list of the most popular clients at https://git-scm.com/downloads/guis[]. A more comprehensive list is available on the Git wiki site, at https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#Graphical_Interfaces[]. ////////////////////////// グラフィカルなGitクライアントは他にもあり、一つの目的に特化したツールから、Gitのできることは全て操作可能にしようとしているアプリケーションまで多岐に渡ります。 -Gitのオフィシャルウェブサイトには、よく使われているクライアントのリストがあります。詳しくは http://git-scm.com/downloads/guis[] を参照してください。 +Gitのオフィシャルウェブサイトには、よく使われているクライアントのリストがあります。詳しくは https://git-scm.com/downloads/guis[] を参照してください。 また、より包括的なリストは Git wiki のサイトに掲載されています。詳しくは https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#Graphical_Interfaces[] を参照してください。 diff --git a/book/A-git-in-other-environments/sections/jetbrainsides.asc b/book/A-git-in-other-environments/sections/jetbrainsides.asc new file mode 100644 index 00000000..e7e3110f --- /dev/null +++ b/book/A-git-in-other-environments/sections/jetbrainsides.asc @@ -0,0 +1,25 @@ +////////////////////////// +=== Git in IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine +////////////////////////// +=== IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine で Gitを使う + +////////////////////////// +JetBrains IDEs (such as IntelliJ IDEA, PyCharm, WebStorm, PhpStorm, RubyMine, and others) ship with a Git Integration plugin. +It provides a dedicated view in the IDE to work with Git and GitHub Pull Requests. +////////////////////////// +JetBrainsのIDE(IntelliJ IDEA、PyCharm、WebStorm、PhpStorm、RubyMine、その他のような)はGitを統合したプラグインを同梱しています。 +これはGitおよびGitHubプルリクエストと連携する専用インタフェースをIDEに提供します。 + +////////////////////////// +.Version Control ToolWindow in JetBrains IDEs. +image::images/jb.png[Version Control ToolWindow in JetBrains IDEs.] +////////////////////////// +.JetBrains IDEのバージョン管理ウィンドウ. +image::images/jb.png[JetBrains IDEのバージョン管理ウィンドウ.] + +////////////////////////// +The integration relies on the command-line git client, and requires one to be installed. +The official documentation is available at https://www.jetbrains.com/help/idea/using-git-integration.html[]. +////////////////////////// +この統合プラグインはコマンドラインのgitクライアントに依存しており、gitクライアントがインストールされている必要があります。 +公式ドキュメントは https://www.jetbrains.com/help/idea/using-git-integration.html[] で参照できます。 diff --git a/book/A-git-in-other-environments/sections/powershell.asc b/book/A-git-in-other-environments/sections/powershell.asc index 2c8de9e3..05605802 100644 --- a/book/A-git-in-other-environments/sections/powershell.asc +++ b/book/A-git-in-other-environments/sections/powershell.asc @@ -1,53 +1,162 @@ -[[r_git_powershell]] +[[_git_powershell]] ////////////////////////// -=== Git in Powershell +=== Git in PowerShell ////////////////////////// -=== PowershellでGitを使う +=== PowerShellでGitを使う -(((powershell)))(((tab completion, powershell)))(((shell prompts, powershell))) +(((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. +The legacy 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. +This also works if you're running PowerShell Core on Linux or macOS. +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を使用しているならラッキーです。 -Posh-Git (https://github.com/dahlbyk/posh-git[]) というパッケージが、強力なタブ補完機能や、リポジトリの状態を把握するのに役立つプロンプト表示を提供しています。 +Windowsのレガシーコマンドライン端末(`cmd.exe`)では、Git向けにユーザ経験をカスタマイズすることができません。一方、PowerShellを使用しているならラッキーです。 +PowerShell CoreをLinuxやmacOSで動作させていれば、PowerShellが動作します。 +posh-git (https://github.com/dahlbyk/posh-git[]) というパッケージが、強力なタブ補完機能や、リポジトリの状態を把握するのに役立つプロンプト表示を提供しています。 表示は次のようになります。 ////////////////////////// -.Powershell with Posh-git. -image::images/posh-git.png[Powershell with Posh-git.] +.PowerShell with Posh-git. +image::images/posh-git.png[PowerShell with Posh-git.] ////////////////////////// .PowershellでPosh-gitを使う image::images/posh-git.png[PowershellでPosh-gitを使う] ////////////////////////// -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\\Documents\WindowsPowerShell`): +==== Installation ////////////////////////// -Windows用のGitHubクライアントをインストールしている場合は、Posh-Gitがデフォルトで含まれています。必要な作業は、 `profile.ps1` (通常 `C:\Users\\Documents\WindowsPowerShell` に配置されます)に次の内容を追加するだけです。 +==== インストールする + +////////////////////////// +===== Prerequisites (Windows only) +////////////////////////// +===== 前提条件 (Window限定) + +////////////////////////// +Before you're able to run PowerShell scripts on your machine, you need to set your local `ExecutionPolicy` to `RemoteSigned` (basically, anything except `Undefined` and `Restricted`). +If you choose `AllSigned` instead of `RemoteSigned`, also local scripts (your own) need to be digitally signed in order to be executed. +With `RemoteSigned`, only scripts having the `ZoneIdentifier` set to `Internet` (were downloaded from the web) need to be signed, others not. +If you're an administrator and want to set it for all users on that machine, use `-Scope LocalMachine`. +If you're a normal user, without administrative rights, you can use `-Scope CurrentUser` to set it only for you. +////////////////////////// +PowerShellスクリプトをあなたのマシンで動作できるようには、ローカル `ExecutionPolicy` を `RemoteSigned` に設定しておく必要があります(基本的には、 `Undefined` と `Restricted` 以外ならば何でも構いません)。 +`RemoteSigned` の代わりに `AllSigned` を選択した場合は、(あなた自身が作成した)ローカルのスクリプトも、実行のために電子署名が必要となります。 +`RemoteSigned` に設定したならば、 `ZoneIdentifier` が `Internet` に設定されている(インターネット上でダウンロードされた)スクリプトだけが署名が必要で、ほかは必要ありません。 +あなたが管理者で、マシンのユーザー全員に実行ポリシーを設定したいのであれば、 `-Scope LocalMachine` を利用してください。 +あなたが管理者権限の無い通常のユーザーならば、 `-Scope CurrentUser` を利用してあなたに実行ポリシーを適用できます。 + +////////////////////////// +More about PowerShell Scopes: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes[] +////////////////////////// +PowerShell のスコープについてもっと知りたい方はこちら: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes[] + +////////////////////////// +More about PowerShell ExecutionPolicy: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy[] +////////////////////////// +PowerShell の実行ポリシーについてもっと知りたい方はこちら: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy[] + +////////////////////////// +To set the value of `ExecutionPolicy` to `RemoteSigned` for all users use the next command: +////////////////////////// +`ExecutionPolicy` の値を全ユーザーのために `RemoteSigned` に設定するときは、次のコマンドを使います。 + +[source,powershell] +---- +> Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force +---- + +////////////////////////// +===== PowerShell Gallery +////////////////////////// +===== PowerShell ギャラリー + +////////////////////////// +If you have at least PowerShell 5 or PowerShell 4 with PackageManagement installed, you can use the package manager to install posh-git for you. +////////////////////////// +少なくともPackageManagementが同梱されているPowerShell 5 か PowerShell 4 をお持ちでしたら、posh-gitのインストールにパッケージマネージャーを使うことができます。 + +////////////////////////// +More information about PowerShell Gallery: https://docs.microsoft.com/en-us/powershell/scripting/gallery/overview[] +////////////////////////// +PowerShell ギャラリーについてもっと知りたい方はこちら: https://docs.microsoft.com/en-us/powershell/scripting/gallery/overview[] + +[source,powershell] +---- +> Install-Module posh-git -Scope CurrentUser -Force +> Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force # Newer beta version with PowerShell Core support +---- + +////////////////////////// +If you want to install posh-git for all users, use `-Scope AllUsers` instead and execute the command from an elevated PowerShell console. +If the second command fails with an error like `Module 'PowerShellGet' was not installed by using Install-Module`, you'll need to run another command first: +////////////////////////// +posh-gitを全てのユーザー向けにインストールしたい場合は、かわりに `-Scope AllUsers` 指定し、管理者権限を持ったPowerShellコンソールでコマンドを実行してください。 +2つ目のコマンドが `Module 'PowerShellGet' was not installed by using Install-Module` のようなエラーで失敗したときは、まず別のコマンドを実行する必要があります。 + +[source,powershell] +---- +> Install-Module PowerShellGet -Force -SkipPublisherCheck +---- + +////////////////////////// +Then you can go back and try again. +This happens, because the modules that ship with Windows PowerShell are signed with a different publishment certificate. +////////////////////////// +上記を実行したら戻って再度試してみると良いでしょう。 +Windows PowerShellに同梱されたモジュールが異なる発行済み証明書で署名され、上手くいくようになります。 + +////////////////////////// +===== Update PowerShell Prompt +////////////////////////// +===== PowerShellのプロンプトを更新する + +////////////////////////// +To include git information in your prompt, the posh-git module needs to be imported. +To have posh-git imported every time PowerShell starts, execute the `Add-PoshGitToProfile` command which will add the import statement into your `$profile` script. +This script is executed everytime you open a new PowerShell console. +Keep in mind, that there are multiple `$profile` scripts. +E. g. one for the console and a separate one for the ISE. +////////////////////////// +gitの情報をプロンプトに含めるためには、posh-gitモジュールがインポートされる必要があります。 +PowerShellが起動する時に毎回posh-gitをインポートさせるには、 `$profile` スクリプトにimportステートメントを追加するコマンド、 `Add-PoshGitToProfile` を実行してください。 +このスクリプトはPowerShellコンソールを開くたびに実行されます。 +`$profile` スクリプトは複数ある、ということに注意してください。 +例えば、あるものはコンソール向け、またあるものはISE向けのもの、といった具合に。 [source,powershell] ------ -. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1") -. $env:github_posh_git\profile.example.ps1 ------ +---- +> Import-Module posh-git +> Add-PoshGitToProfile -AllHosts +---- ////////////////////////// -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: +===== From Source ////////////////////////// -Windows用GitHubクライアントのユーザでない場合は、 (https://github.com/dahlbyk/posh-git[]) からPosh-Gitのリリースをダウンロードし、 `WindowsPowershell` ディレクトリに解凍してください。 -その後、管理者権限で PowerShell プロンプトを開き、次の操作を行います。 +===== ソースコードを使ってインポートする + +////////////////////////// +Just download a posh-git release from https://github.com/dahlbyk/posh-git/releases[], and uncompress it. +Then import the module using the full path to the `posh-git.psd1` file: +////////////////////////// +https://github.com/dahlbyk/posh-git/releases[] から、リリースされたposh-gitをダウンロードし、解凍します。 +そして以下のように `posh-git.psd1` ファイルのフルパスを指定してモジュールをインポートします。 [source,powershell] ------ -> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm -> cd ~\Documents\WindowsPowerShell\posh-git -> .\install.ps1 ------ +---- +> Import-Module \src\posh-git.psd1 +> Add-PoshGitToProfile -AllHosts +---- + +////////////////////////// +This will add the proper line to your `profile.ps1` file, and posh-git will be active the next time you open PowerShell. +////////////////////////// +これで `profile.ps1`ファイルに適切な内容が追加されます。次にPowerShellを開いた時に、 posh-git が有効になります。 ////////////////////////// -This will add the proper line to your `profile.ps1` file, and posh-git will be active the next time you open your prompt. +For a description of the Git status summary information displayed in the prompt see: https://github.com/dahlbyk/posh-git/blob/master/README.md#git-status-summary-information[] +For more details on how to customize your posh-git prompt see: https://github.com/dahlbyk/posh-git/blob/master/README.md#customization-variables[] ////////////////////////// -これで `profile.ps1`ファイルに適切な内容が追加されます。次にプロンプトを開いた時に、 posh-git が有効になります。 +プロンプトに表示されるGitに関する情報の詳細は、こちらを参照ください。 https://github.com/dahlbyk/posh-git/blob/master/README.md#git-status-summary-information[] +posh-gitのプロンプトのカスタマイズ方法の詳細は、こちらを参照ください。 https://github.com/dahlbyk/posh-git/blob/master/README.md#customization-variables[] \ No newline at end of file diff --git a/book/A-git-in-other-environments/sections/sublimetext.asc b/book/A-git-in-other-environments/sections/sublimetext.asc new file mode 100644 index 00000000..9a8b9aec --- /dev/null +++ b/book/A-git-in-other-environments/sections/sublimetext.asc @@ -0,0 +1,34 @@ +////////////////////////// +=== Git in Sublime Text +////////////////////////// +=== Sublime Text で Git を使う + +////////////////////////// +From version 3.2 onwards, Sublime Text has git integration in the editor. +////////////////////////// +バージョン3.2以降、Sublime Textはエディタにgitを統合しています。 + +////////////////////////// +The features are: +////////////////////////// +機能は以下の通りです。 + +////////////////////////// +* The sidebar will show the git status of files and folders with a badge/icon. +* Files and folders that are in your .gitignore file will be faded out in the sidebar. +* In the status bar, you can see the current git branch and how many modifications you have made. +* All changes to a file are now visible via markers in the gutter. +* You can use part of the Sublime Merge git client functionality from within Sublime Text. + (This requires that Sublime Merge is installed. See: https://www.sublimemerge.com/[]) +////////////////////////// +*サイドバーで、ファイルのgit状態をバッヂ/アイコンで示します。 +*.gitignoreファイルにあるファイルやフォルダはサイドバーからフェードアウトします。 +*ステータスバーでは、現在のブランチとどれ程の修正を行ったかを見ることができます。 +*ファイルへの全ての変更が、Gutterでのマーカー表示で見ることができます。 +*gitのクライアントであるSublime Mergeの機能の一部をSublime Textから利用することができます。 +(このためにはSublime Mergeがインストールされている必要があります。こちらを参照ください:https://www.sublimemerge.com/[]) + +////////////////////////// +The official documentation for Sublime Text can be found here: https://www.sublimetext.com/docs/3/git_integration.html[] +////////////////////////// +Sublime Textの公式ドキュメントはこちらで見ることができます:https://www.sublimetext.com/docs/3/git_integration.html[] diff --git a/book/A-git-in-other-environments/sections/visualstudio.asc b/book/A-git-in-other-environments/sections/visualstudio.asc index 563c8359..6810fdf8 100644 --- a/book/A-git-in-other-environments/sections/visualstudio.asc +++ b/book/A-git-in-other-environments/sections/visualstudio.asc @@ -30,20 +30,19 @@ image::images/vs-1.png[チームエクスプローラからGitリポジトリへ ////////////////////////// Visual Studio remembers all of the projects you've opened that are Git-controlled, and they're available in the list at the bottom. If you don't see the one you want there, click the "Add" link and type in the path to the working directory. -Double clicking on one of the local Git repositories leads you to the Home view, which looks like <>. +Double clicking on one of the local Git repositories leads you to the Home view, which looks like <>. This is a hub for performing Git actions; when you're _writing_ code, you'll probably spend most of your time in the "Changes" view, but when it comes time to pull down changes made by your teammates, you'll use the "Unsynced Commits" and "Branches" views. ////////////////////////// Visual Studioは、これまでに開いたプロジェクトのうち、Gitの制御下にあるものをすべて記憶しています。下部のリストからそれを選択できます。 開きたいプロジェクトが表示されていない場合は、「追加」リンクをクリックして作業ディレクトリへのパスを入力します。 -ローカルのGitリポジトリをダブルクリックすると、<> のようなホームビューが表示されます。 +ローカルのGitリポジトリをダブルクリックすると、<> のようなホームビューが表示されます。 これはGitのアクションを実行するためのハブとして働きます。コードを _書いて_ いる間は、おそらく「変更」ビューでほとんどの時間を費やすはずです。チームメイトが行った変更をプルするときは、「同期されていないコミット」ビューと「分岐」ビューを使用することになるでしょう。 +[[vs_home]] ////////////////////////// -[[rvs_home]] .The "Home" view for a Git repository in Visual Studio. image::images/vs-2.png[The Home view for a Git repository in Visual Studio.] ////////////////////////// -[[rvs_home]] .Visual StudioでのGitリポジトリの"ホーム"ビュー image::images/vs-2.png[Visual StudioでのGitリポジトリの"ホーム"ビュー] diff --git a/book/A-git-in-other-environments/sections/visualstudiocode.asc b/book/A-git-in-other-environments/sections/visualstudiocode.asc new file mode 100644 index 00000000..a60961fe --- /dev/null +++ b/book/A-git-in-other-environments/sections/visualstudiocode.asc @@ -0,0 +1,47 @@ +////////////////////////// +=== Git in Visual Studio Code +////////////////////////// +=== Visual Studio Code で Git を使う + +////////////////////////// +Visual Studio Code has git support built in. +You will need to have git version 2.0.0 (or newer) installed. +////////////////////////// +Visual Studio Code にはGitの備え付けのサポートがあります。 +gitのバージョン2.0.0(またはそれ以降)が必要になります。 + +////////////////////////// +The main features are: +////////////////////////// +主な機能は以下の通りです。 + +////////////////////////// +* See the diff of the file you are editing in the gutter. +* The Git Status Bar (lower left) shows the current branch, dirty indicators, incoming and outgoing commits. +* You can do the most common git operations from within the editor: +** Initialize a repository. +** Clone a repository. +** Create branches and tags. +** Stage and commit changes. +** Push/pull/sync with a remote branch. +** Resolve merge conflicts. +** View diffs. +* With an extension, you can also handle GitHub Pull Requests: +////////////////////////// +*ガターインジケータ(訳注:gutter)で、編集中のファイルの差分を見ることができます +*Gitステータスバー(左下部)が、現在のブランチ、ダーティな状態、新旧のコミットを表示してくれます。 +*最もよく使うgit操作をエディタ内で使うことができます。 +** リポジトリの初期化 +** リポジトリのクローン +** ブランチとタグの作成 +** 変更のステージングとコミット +** リモートブランチとのプッシュ、プル、同期 +** マージの競合の解決 +** 差分の閲覧 +*拡張機能を利用してGitHubにプルリクエスト + https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github[] + +////////////////////////// +The official documentation can be found here: https://code.visualstudio.com/Docs/editor/versioncontrol[] +////////////////////////// +公式のドキュメントはこちらです: https://code.visualstudio.com/Docs/editor/versioncontrol[] diff --git a/book/A-git-in-other-environments/sections/zsh.asc b/book/A-git-in-other-environments/sections/zsh.asc index 33c3707f..567db614 100644 --- a/book/A-git-in-other-environments/sections/zsh.asc +++ b/book/A-git-in-other-environments/sections/zsh.asc @@ -10,7 +10,7 @@ To use it, simply run `autoload -Uz compinit && compinit` in your `.zshrc`. Zsh's interface is a bit more powerful than Bash's: ////////////////////////// Zshには、Git用のタブ補完ライブラリも同梱されています。 -`.zshrc`に`autoload -Uz compinit && compinit`という行を追加するだけで、使えるようになります。 +`.zshrc` に `autoload -Uz compinit && compinit` という行を追加するだけで、使えるようになります。 Zshのインターフェイスは、Bashよりさらに強力です。 [source,console] @@ -41,7 +41,7 @@ To include the branch name in the prompt on the right side, add these lines to y [source,console] ---- autoload -Uz vcs_info -precmd_vcs_info() { vcs_info } +precmd_vcs_info() { vcs_info } precmd_functions+=( precmd_vcs_info ) setopt prompt_subst RPROMPT=\$vcs_info_msg_0_ @@ -59,42 +59,39 @@ It looks a bit like this: 見た目は次のようになります。 ////////////////////////// -.Customized `zsh` prompt. +.Customized `zsh` prompt image::images/zsh-prompt.png[Customized `zsh` prompt.] ////////////////////////// .カスタマイズされた `zsh` のプロンプト image::images/zsh-prompt.png[カスタマイズされた `zsh` のプロンプト] ////////////////////////// -For more information on vcs_info, check out its documentation - in the `zshcontrib(1)` manual page, - or online at http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information[]. +For more information on `vcs_info`, check out its documentation in the `zshcontrib(1)` manual page, or online at http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information[]. ////////////////////////// -vcs_infoについての詳細は、`zshcontrib(1)`マニュアルにあるドキュメントか、オンラインであれば http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information[] を確認してみてください。 +`vcs_info` についての詳細は、`zshcontrib(1)` マニュアルにあるドキュメントか、オンラインであれば http://zsh.sourceforge.net/Doc/Release/User-Contributions.html#Version-Control-Information[] を確認してみてください。 ////////////////////////// -Instead of vcs_info, you might prefer the prompt customization script that ships with Git, called `git-prompt.sh`; see http://git-prompt.sh[] for details. +Instead of `vcs_info`, you might prefer the prompt customization script that ships with Git, called `git-prompt.sh`; see https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh[] for details. `git-prompt.sh` is compatible with both Bash and Zsh. ////////////////////////// -一方、Gitに同梱されている`git-prompt.sh`というスクリプトでも、プロンプトをカスタマイズすることができます。vcs_infoよりも気に入るかもしれませんね。詳しくは http://git-prompt.sh[] を確認してみてください。 -`git-prompt.sh`はBashとZshの両方に対応しています。 +一方、Gitに同梱されている `git-prompt.sh` というスクリプトでも、プロンプトをカスタマイズすることができます。 `vcs_info` よりも気に入るかもしれませんね。詳しくは https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh[] を確認してみてください。 +`git-prompt.sh` はBashとZshの両方に対応しています。 ////////////////////////// Zsh is powerful enough that there are entire frameworks dedicated to making it better. One of them is called "oh-my-zsh", and it can be found at https://github.com/robbyrussell/oh-my-zsh[]. oh-my-zsh's plugin system comes with powerful git tab-completion, and it has a variety of prompt "themes", many of which display version-control data. -<> is just one example of what can be done with this system. +<> is just one example of what can be done with this system. ////////////////////////// Zshは非常にパワフルであり、Zshには自身を改善するためのフレームワークも備わっています。 そのフレームワークの一つに "oh-my-zsh" があります。これは https://github.com/robbyrussell/oh-my-zsh[] にあります。 oh-my-zshのプラグインシステムには、強力なGit用タブ補完機能が付属しています。また、各種のプロンプトの「テーマ」が付属していて、バージョン管理に関するデータをプロンプトに表示できます。 -<> は、このシステムでできることの一例に過ぎません。 +<> は、このシステムでできることの一例に過ぎません。 +[[oh_my_zsh_git]] ////////////////////////// -[[roh_my_zsh_git]] -.An example of an oh-my-zsh theme. +.An example of an oh-my-zsh theme image::images/zsh-oh-my.png[An example of an oh-my-zsh theme.] ////////////////////////// -[[roh_my_zsh_git]] .oh-my-zshのテーマの例 image::images/zsh-oh-my.png[oh-my-zshのテーマの例] diff --git a/images/jb.png b/images/jb.png new file mode 100644 index 00000000..2ffe74a8 Binary files /dev/null and b/images/jb.png differ diff --git a/status.json b/status.json index edbac8e9..f8c6afbb 100644 --- a/status.json +++ b/status.json @@ -111,8 +111,11 @@ "sections/bash.asc": 100, "sections/eclipse.asc": 100, "sections/guis.asc": 100, + "sections/jetbrainsides.asc": 100, "sections/powershell.asc": 100, + "sections/sublimetext.asc": 100, "sections/visualstudio.asc": 100, + "sections/visualstudiocode.asc": 100, "sections/zsh.asc": 100 }, "B-embedding-git": {