Skip to content

Commit 9d2619e

Browse files
dschodscho
authored andcommitted
Merge branch 'book-ms' of bundle-ms/ms.bundle into hugo
2 parents d3d5258 + 8ffcc39 commit 9d2619e

File tree

910 files changed

+29368
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

910 files changed

+29368
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
### DO NOT EDIT! Generated by script/update-book2.rb
3+
redirect_to: book/ms/v2
4+
---
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
### DO NOT EDIT! Generated by script/update-book2.rb
3+
category: book
4+
section: documentation
5+
subsection: book
6+
sidebar: book
7+
book:
8+
language_code: ms
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Bash
14+
number: 6
15+
cs_number: A1.6
16+
previous: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Sublime-Text
17+
next: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Zsh
18+
title: Git - Git in Bash
19+
url: "/book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Bash.html"
20+
---
21+
<h2 id="_git_in_bash">Git in Bash</h2>
22+
<div class="paragraph">
23+
<p>
24+
If you’re a Bash user, you can tap into some of your shell’s features to make your experience with Git a lot friendlier.
25+
Git actually ships with plugins for several shells, but it’s not turned on by default.</p>
26+
</div>
27+
<div class="paragraph">
28+
<p>First, you need to get a copy of the completions file from the source code of the Git release you’re using.
29+
Check your version by typing <code>git version</code>, then use <code>git checkout tags/vX.Y.Z</code>, where <code>vX.Y.Z</code> corresponds to the version of Git you are using.
30+
Copy the <code>contrib/completion/git-completion.bash</code> file somewhere handy, like your home directory, and add this to your <code>.bashrc</code>:</p>
31+
</div>
32+
<div class="listingblock">
33+
<div class="content">
34+
<pre class="highlight"><code class="language-console" data-lang="console">. ~/git-completion.bash</code></pre>
35+
</div>
36+
</div>
37+
<div class="paragraph">
38+
<p>Once that’s done, change your directory to a Git repository, and type:</p>
39+
</div>
40+
<div class="listingblock">
41+
<div class="content">
42+
<pre class="highlight"><code class="language-console" data-lang="console">$ git chec&lt;tab&gt;</code></pre>
43+
</div>
44+
</div>
45+
<div class="paragraph">
46+
<p>…and Bash will auto-complete to <code>git checkout</code>.
47+
This works with all of Git’s subcommands, command-line parameters, and remotes and ref names where appropriate.</p>
48+
</div>
49+
<div class="paragraph">
50+
<p>It’s also useful to customize your prompt to show information about the current directory’s Git repository.
51+
This can be as simple or complex as you want, but there are generally a few key pieces of information that most people want, like the current branch, and the status of the working directory.
52+
To add these to your prompt, just copy the <code>contrib/completion/git-prompt.sh</code> file from Git’s source repository to your home directory, add something like this to your <code>.bashrc</code>:</p>
53+
</div>
54+
<div class="listingblock">
55+
<div class="content">
56+
<pre class="highlight"><code class="language-console" data-lang="console">. ~/git-prompt.sh
57+
export GIT_PS1_SHOWDIRTYSTATE=1
58+
export PS1='\w$(__git_ps1 " (%s)")\$ '</code></pre>
59+
</div>
60+
</div>
61+
<div class="paragraph">
62+
<p>The <code>\w</code> means print the current working directory, the <code>\$</code> prints the <code>$</code> part of the prompt, and <code>__git_ps1 " (%s)"</code> calls the function provided by <code>git-prompt.sh</code> with a formatting argument.
63+
Now your bash prompt will look like this when you’re anywhere inside a Git-controlled project:</p>
64+
</div>
65+
<div class="imageblock">
66+
<div class="content">
67+
<img src="{{< relurl "book/ms/v2/images/git-bash.png" >}}" alt="Customized `bash` prompt">
68+
</div>
69+
<div class="title">Figure 158. Customized <code>bash</code> prompt</div>
70+
</div>
71+
<div class="paragraph">
72+
<p>Both of these scripts come with helpful documentation; take a look at the contents of <code>git-completion.bash</code> and <code>git-prompt.sh</code> for more information.</p>
73+
</div>
74+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
### DO NOT EDIT! Generated by script/update-book2.rb
3+
category: book
4+
section: documentation
5+
subsection: book
6+
sidebar: book
7+
book:
8+
language_code: ms
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine
14+
number: 4
15+
cs_number: A1.4
16+
previous: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Visual-Studio-Code
17+
next: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Sublime-Text
18+
title: Git - Git in IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine
19+
url: "/book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-IntelliJ-/-PyCharm-/-WebStorm-/-PhpStorm-/-RubyMine.html"
20+
---
21+
<h2 id="_git_in_intellij_pycharm_webstorm_phpstorm_rubymine">Git in IntelliJ / PyCharm / WebStorm / PhpStorm / RubyMine</h2>
22+
<div class="paragraph">
23+
<p>JetBrains IDEs (such as IntelliJ IDEA, PyCharm, WebStorm, PhpStorm, RubyMine, and others) ship with a Git Integration plugin.
24+
It provides a dedicated view in the IDE to work with Git and GitHub Pull Requests.</p>
25+
</div>
26+
<div class="imageblock">
27+
<div class="content">
28+
<img src="{{< relurl "book/ms/v2/images/jb.png" >}}" alt="Version Control ToolWindow in JetBrains IDEs">
29+
</div>
30+
<div class="title">Figure 157. Version Control ToolWindow in JetBrains IDEs</div>
31+
</div>
32+
<div class="paragraph">
33+
<p>The integration relies on the command-line git client, and requires one to be installed.
34+
The official documentation is available at <a href="https://www.jetbrains.com/help/idea/using-git-integration.html" class="bare" target="_blank" rel="noopener">https://www.jetbrains.com/help/idea/using-git-integration.html</a>.</p>
35+
</div>
36+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
---
2+
### DO NOT EDIT! Generated by script/update-book2.rb
3+
category: book
4+
section: documentation
5+
subsection: book
6+
sidebar: book
7+
book:
8+
language_code: ms
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in PowerShell
14+
number: 8
15+
cs_number: A1.8
16+
previous: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Zsh
17+
next: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Summary
18+
title: Git - Git in PowerShell
19+
url: "/book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-PowerShell.html"
20+
---
21+
<h2 id="_git_powershell">Git in PowerShell</h2>
22+
<div class="paragraph">
23+
<p>
24+
25+
The legacy command-line terminal on Windows (<code>cmd.exe</code>) isn’t really capable of a customized Git experience, but if you’re using PowerShell, you’re in luck.
26+
This also works if you’re running PowerShell Core on Linux or macOS.
27+
A package called posh-git (<a href="https://github.com/dahlbyk/posh-git" class="bare" target="_blank" rel="noopener">https://github.com/dahlbyk/posh-git</a>) provides powerful tab-completion facilities, as well as an enhanced prompt to help you stay on top of your repository status.
28+
It looks like this:</p>
29+
</div>
30+
<div class="imageblock">
31+
<div class="content">
32+
<img src="{{< relurl "book/ms/v2/images/posh-git.png" >}}" alt="PowerShell with Posh-git">
33+
</div>
34+
<div class="title">Figure 161. PowerShell with Posh-git</div>
35+
</div>
36+
<div class="sect3">
37+
<h3 id="_installation_3">Installation</h3>
38+
<div class="sect4">
39+
<h4 id="_prerequisites_windows_only">Prerequisites (Windows only)</h4>
40+
<div class="paragraph">
41+
<p>Before you’re able to run PowerShell scripts on your machine, you need to set your local <code>ExecutionPolicy</code> to <code>RemoteSigned</code> (basically, anything except <code>Undefined</code> and <code>Restricted</code>).
42+
If you choose <code>AllSigned</code> instead of <code>RemoteSigned</code>, also local scripts (your own) need to be digitally signed in order to be executed.
43+
With <code>RemoteSigned</code>, only scripts having the <code>ZoneIdentifier</code> set to <code>Internet</code> (were downloaded from the web) need to be signed, others not.
44+
If you’re an administrator and want to set it for all users on that machine, use <code>-Scope LocalMachine</code>.
45+
If you’re a normal user, without administrative rights, you can use <code>-Scope CurrentUser</code> to set it only for you.</p>
46+
</div>
47+
<div class="paragraph">
48+
<p>More about PowerShell Scopes: <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes" class="bare" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_scopes</a>.</p>
49+
</div>
50+
<div class="paragraph">
51+
<p>More about PowerShell ExecutionPolicy: <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy" class="bare" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy</a>.</p>
52+
</div>
53+
<div class="paragraph">
54+
<p>To set the value of <code>ExecutionPolicy</code> to <code>RemoteSigned</code> for all users use the next command:</p>
55+
</div>
56+
<div class="listingblock">
57+
<div class="content">
58+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">&gt; Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy RemoteSigned -Force</code></pre>
59+
</div>
60+
</div>
61+
</div>
62+
<div class="sect4">
63+
<h4 id="_powershell_gallery">PowerShell Gallery</h4>
64+
<div class="paragraph">
65+
<p>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.</p>
66+
</div>
67+
<div class="paragraph">
68+
<p>More information about PowerShell Gallery: <a href="https://docs.microsoft.com/en-us/powershell/scripting/gallery/overview" class="bare" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/powershell/scripting/gallery/overview</a>.</p>
69+
</div>
70+
<div class="listingblock">
71+
<div class="content">
72+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">&gt; Install-Module posh-git -Scope CurrentUser -Force
73+
&gt; Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force # Newer beta version with PowerShell Core support</code></pre>
74+
</div>
75+
</div>
76+
<div class="paragraph">
77+
<p>If you want to install posh-git for all users, use <code>-Scope AllUsers</code> instead and execute the command from an elevated PowerShell console.
78+
If the second command fails with an error like <code>Module 'PowerShellGet' was not installed by using Install-Module</code>, you’ll need to run another command first:</p>
79+
</div>
80+
<div class="listingblock">
81+
<div class="content">
82+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">&gt; Install-Module PowerShellGet -Force -SkipPublisherCheck</code></pre>
83+
</div>
84+
</div>
85+
<div class="paragraph">
86+
<p>Then you can go back and try again.
87+
This happens, because the modules that ship with Windows PowerShell are signed with a different publishment certificate.</p>
88+
</div>
89+
</div>
90+
<div class="sect4">
91+
<h4 id="_update_powershell_prompt">Update PowerShell Prompt</h4>
92+
<div class="paragraph">
93+
<p>To include git information in your prompt, the posh-git module needs to be imported.
94+
To have posh-git imported every time PowerShell starts, execute the <code>Add-PoshGitToProfile</code> command which will add the import statement into your <code>$profile</code> script.
95+
This script is executed everytime you open a new PowerShell console.
96+
Keep in mind, that there are multiple <code>$profile</code> scripts.
97+
E. g. one for the console and a separate one for the ISE.</p>
98+
</div>
99+
<div class="listingblock">
100+
<div class="content">
101+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">&gt; Import-Module posh-git
102+
&gt; Add-PoshGitToProfile -AllHosts</code></pre>
103+
</div>
104+
</div>
105+
</div>
106+
<div class="sect4">
107+
<h4 id="_from_source">From Source</h4>
108+
<div class="paragraph">
109+
<p>Just download a posh-git release from <a href="https://github.com/dahlbyk/posh-git/releases" class="bare" target="_blank" rel="noopener">https://github.com/dahlbyk/posh-git/releases</a>, and uncompress it.
110+
Then import the module using the full path to the <code>posh-git.psd1</code> file:</p>
111+
</div>
112+
<div class="listingblock">
113+
<div class="content">
114+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">&gt; Import-Module &lt;path-to-uncompress-folder&gt;\src\posh-git.psd1
115+
&gt; Add-PoshGitToProfile -AllHosts</code></pre>
116+
</div>
117+
</div>
118+
<div class="paragraph">
119+
<p>This will add the proper line to your <code>profile.ps1</code> file, and posh-git will be active the next time you open PowerShell.</p>
120+
</div>
121+
<div class="paragraph">
122+
<p>For a description of the Git status summary information displayed in the prompt see: <a href="https://github.com/dahlbyk/posh-git/blob/master/README.md#git-status-summary-information" class="bare" target="_blank" rel="noopener">https://github.com/dahlbyk/posh-git/blob/master/README.md#git-status-summary-information</a>
123+
For more details on how to customize your posh-git prompt see: <a href="https://github.com/dahlbyk/posh-git/blob/master/README.md#customization-variables" class="bare" target="_blank" rel="noopener">https://github.com/dahlbyk/posh-git/blob/master/README.md#customization-variables</a>.</p>
124+
</div>
125+
</div>
126+
</div>
127+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
### DO NOT EDIT! Generated by script/update-book2.rb
3+
category: book
4+
section: documentation
5+
subsection: book
6+
sidebar: book
7+
book:
8+
language_code: ms
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Sublime Text
14+
number: 5
15+
cs_number: A1.5
16+
previous: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-IntelliJ-/-PyCharm-/-WebStorm-/-PhpStorm-/-RubyMine
17+
next: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Bash
18+
title: Git - Git in Sublime Text
19+
url: "/book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Sublime-Text.html"
20+
---
21+
<h2 id="_git_in_sublime_text">Git in Sublime Text</h2>
22+
<div class="paragraph">
23+
<p>From version 3.2 onwards, Sublime Text has git integration in the editor.</p>
24+
</div>
25+
<div class="paragraph">
26+
<p>The features are:</p>
27+
</div>
28+
<div class="ulist">
29+
<ul>
30+
<li>
31+
<p>The sidebar will show the git status of files and folders with a badge/icon.</p>
32+
</li>
33+
<li>
34+
<p>Files and folders that are in your .gitignore file will be faded out in the sidebar.</p>
35+
</li>
36+
<li>
37+
<p>In the status bar, you can see the current git branch and how many modifications you have made.</p>
38+
</li>
39+
<li>
40+
<p>All changes to a file are now visible via markers in the gutter.</p>
41+
</li>
42+
<li>
43+
<p>You can use part of the Sublime Merge git client functionality from within Sublime Text.
44+
This requires that Sublime Merge is installed. See: <a href="https://www.sublimemerge.com/" class="bare" target="_blank" rel="noopener">https://www.sublimemerge.com/</a>.</p>
45+
</li>
46+
</ul>
47+
</div>
48+
<div class="paragraph">
49+
<p>The official documentation for Sublime Text can be found here: <a href="https://www.sublimetext.com/docs/3/git_integration.html" class="bare" target="_blank" rel="noopener">https://www.sublimetext.com/docs/3/git_integration.html</a>.</p>
50+
</div>
51+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
### DO NOT EDIT! Generated by script/update-book2.rb
3+
category: book
4+
section: documentation
5+
subsection: book
6+
sidebar: book
7+
book:
8+
language_code: ms
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Visual Studio Code
14+
number: 3
15+
cs_number: A1.3
16+
previous: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Visual-Studio
17+
next: book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-IntelliJ-/-PyCharm-/-WebStorm-/-PhpStorm-/-RubyMine
18+
title: Git - Git in Visual Studio Code
19+
url: "/book/ms/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Visual-Studio-Code.html"
20+
---
21+
<h2 id="_git_in_visual_studio_code">Git in Visual Studio Code</h2>
22+
<div class="paragraph">
23+
<p>Visual Studio Code has git support built in.
24+
You will need to have git version 2.0.0 (or newer) installed.</p>
25+
</div>
26+
<div class="paragraph">
27+
<p>The main features are:</p>
28+
</div>
29+
<div class="ulist">
30+
<ul>
31+
<li>
32+
<p>See the diff of the file you are editing in the gutter.</p>
33+
</li>
34+
<li>
35+
<p>The Git Status Bar (lower left) shows the current branch, dirty indicators, incoming and outgoing commits.</p>
36+
</li>
37+
<li>
38+
<p>You can do the most common git operations from within the editor:</p>
39+
<div class="ulist">
40+
<ul>
41+
<li>
42+
<p>Initialize a repository.</p>
43+
</li>
44+
<li>
45+
<p>Clone a repository.</p>
46+
</li>
47+
<li>
48+
<p>Create branches and tags.</p>
49+
</li>
50+
<li>
51+
<p>Stage and commit changes.</p>
52+
</li>
53+
<li>
54+
<p>Push/pull/sync with a remote branch.</p>
55+
</li>
56+
<li>
57+
<p>Resolve merge conflicts.</p>
58+
</li>
59+
<li>
60+
<p>View diffs.</p>
61+
</li>
62+
</ul>
63+
</div>
64+
</li>
65+
<li>
66+
<p>With an extension, you can also handle GitHub Pull Requests:
67+
<a href="https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github" class="bare" target="_blank" rel="noopener">https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github</a>.</p>
68+
</li>
69+
</ul>
70+
</div>
71+
<div class="paragraph">
72+
<p>The official documentation can be found here: <a href="https://code.visualstudio.com/Docs/editor/versioncontrol" class="bare" target="_blank" rel="noopener">https://code.visualstudio.com/Docs/editor/versioncontrol</a>.</p>
73+
</div>
74+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>

0 commit comments

Comments
 (0)