Skip to content

Commit e1b1b64

Browse files
dschodscho
authored andcommitted
book: update uz
Updated via the `update-book.yml` GitHub workflow.
1 parent 4bd4ba9 commit e1b1b64

File tree

875 files changed

+26628
-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.

875 files changed

+26628
-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/uz/v2
4+
---
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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: uz
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Bash
14+
number: 4
15+
cs_number: A1.4
16+
previous: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Eclipse
17+
next: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Zsh
18+
title: Git - Git in Bash
19+
url: "/book/uz/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 <code>contrib/completion/git-completion.bash</code> file out of the Git source code.
29+
Copy it somewhere handy, like your home directory, and add this to your <code>.bashrc</code>:</p>
30+
</div>
31+
<div class="listingblock">
32+
<div class="content">
33+
<pre class="highlight"><code class="language-console" data-lang="console">. ~/git-completion.bash</code></pre>
34+
</div>
35+
</div>
36+
<div class="paragraph">
37+
<p>Once that’s done, change your directory to a git repository, and type:</p>
38+
</div>
39+
<div class="listingblock">
40+
<div class="content">
41+
<pre class="highlight"><code class="language-console" data-lang="console">$ git chec&lt;tab&gt;</code></pre>
42+
</div>
43+
</div>
44+
<div class="paragraph">
45+
<p>…and Bash will auto-complete to <code>git checkout</code>.
46+
This works with all of Git’s subcommands, command-line parameters, and remotes and ref names where appropriate.</p>
47+
</div>
48+
<div class="paragraph">
49+
<p>It’s also useful to customize your prompt to show information about the current directory’s Git repository.
50+
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.
51+
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>
52+
</div>
53+
<div class="listingblock">
54+
<div class="content">
55+
<pre class="highlight"><code class="language-console" data-lang="console">. ~/git-prompt.sh
56+
export GIT_PS1_SHOWDIRTYSTATE=1
57+
export PS1='\w$(__git_ps1 " (%s)")\$ '</code></pre>
58+
</div>
59+
</div>
60+
<div class="paragraph">
61+
<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.
62+
Now your bash prompt will look like this when you’re anywhere inside a Git-controlled project:</p>
63+
</div>
64+
<div class="imageblock">
65+
<div class="content">
66+
<img src="{{< relurl "book/uz/v2/images/git-bash.png" >}}" alt="Customized `bash` prompt.">
67+
</div>
68+
<div class="title">Figure 162. Customized <code>bash</code> prompt.</div>
69+
</div>
70+
<div class="paragraph">
71+
<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>
72+
</div>
73+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 36 additions & 0 deletions
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: uz
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Eclipse
14+
number: 3
15+
cs_number: A1.3
16+
previous: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Visual-Studio
17+
next: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Bash
18+
title: Git - Git in Eclipse
19+
url: "/book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Eclipse.html"
20+
---
21+
<h2 id="_git_in_eclipse">Git in Eclipse</h2>
22+
<div class="paragraph">
23+
<p>
24+
Eclipse ships with a plugin called Egit, which provides a fairly-complete interface to Git operations.
25+
It’s accessed by switching to the Git Perspective (Window &gt; Open Perspective &gt; Other…, and select "Git").</p>
26+
</div>
27+
<div class="imageblock">
28+
<div class="content">
29+
<img src="{{< relurl "book/uz/v2/images/egit.png" >}}" alt="Eclipse’s EGit environment.">
30+
</div>
31+
<div class="title">Figure 161. Eclipse’s EGit environment.</div>
32+
</div>
33+
<div class="paragraph">
34+
<p>EGit comes with plenty of great documentation, which you can find by going to Help &gt; Help Contents, and choosing the "EGit Documentation" node from the contents listing.</p>
35+
</div>
36+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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: uz
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Powershell
14+
number: 6
15+
cs_number: A1.6
16+
previous: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Zsh
17+
next: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Summary
18+
title: Git - Git in Powershell
19+
url: "/book/uz/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 standard 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+
A package called Posh-Git (<a href="https://github.com/dahlbyk/posh-git" class="bare">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. It looks like this:</p>
27+
</div>
28+
<div class="imageblock">
29+
<div class="content">
30+
<img src="{{< relurl "book/uz/v2/images/posh-git.png" >}}" alt="Powershell with Posh-git.">
31+
</div>
32+
<div class="title">Figure 165. Powershell with Posh-git.</div>
33+
</div>
34+
<div class="paragraph">
35+
<p>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 <code>profile.ps1</code> (which is usually located in <code>C:\Users\&lt;username&gt;\Documents\WindowsPowerShell</code>):</p>
36+
</div>
37+
<div class="listingblock">
38+
<div class="content">
39+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">. (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
40+
. $env:github_posh_git\profile.example.ps1</code></pre>
41+
</div>
42+
</div>
43+
<div class="paragraph">
44+
<p>If you’re not a GitHub for Windows user, just download a Posh-Git release from (<a href="https://github.com/dahlbyk/posh-git" class="bare">https://github.com/dahlbyk/posh-git</a>), and uncompress it to the <code>WindowsPowershell</code> directory.
45+
Then open a Powershell prompt as the administrator, and do this:</p>
46+
</div>
47+
<div class="listingblock">
48+
<div class="content">
49+
<pre class="highlight"><code class="language-powershell" data-lang="powershell">&gt; Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Confirm
50+
&gt; cd ~\Documents\WindowsPowerShell\posh-git
51+
&gt; .\install.ps1</code></pre>
52+
</div>
53+
</div>
54+
<div class="paragraph">
55+
<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 your prompt.</p>
56+
</div>
57+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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: uz
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Visual Studio
14+
number: 2
15+
cs_number: A1.2
16+
previous: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Graphical-Interfaces
17+
next: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Eclipse
18+
title: Git - Git in Visual Studio
19+
url: "/book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Visual-Studio.html"
20+
---
21+
<h2 id="_git_in_visual_studio">Git in Visual Studio</h2>
22+
<div class="paragraph">
23+
<p>
24+
Starting with Visual Studio 2013 Update 1, Visual Studio users have a Git client built directly into their IDE.
25+
Visual Studio has had source-control integration features for quite some time, but they were oriented towards centralized, file-locking systems, and Git was not a good match for this workflow.
26+
Visual Studio 2013’s Git support has been separated from this older feature, and the result is a much better fit between Studio and Git.</p>
27+
</div>
28+
<div class="paragraph">
29+
<p>To locate the feature, open a project that’s controlled by Git (or just <code>git init</code> an existing project), and select View &gt; Team Explorer from the menu.
30+
You’ll see the "Connect" view, which looks a bit like this:</p>
31+
</div>
32+
<div class="imageblock">
33+
<div class="content">
34+
<img src="{{< relurl "book/uz/v2/images/vs-1.png" >}}" alt="Connecting to a Git repository from Team Explorer.">
35+
</div>
36+
<div class="title">Figure 159. Connecting to a Git repository from Team Explorer.</div>
37+
</div>
38+
<div class="paragraph">
39+
<p>Visual Studio remembers all of the projects you’ve opened that are Git-controlled, and they’re available in the list at the bottom.
40+
If you don’t see the one you want there, click the "Add" link and type in the path to the working directory.
41+
Double clicking on one of the local Git repositories leads you to the Home view, which looks like <a href="{{< relurl "book/uz/v2/ch00/vs_home" >}}">The "Home" view for a Git repository in Visual Studio.</a>.
42+
This is a hub for performing Git actions; when you’re <em>writing</em> 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.</p>
43+
</div>
44+
<div id="vs_home" class="imageblock">
45+
<div class="content">
46+
<img src="{{< relurl "book/uz/v2/images/vs-2.png" >}}" alt="The Home view for a Git repository in Visual Studio.">
47+
</div>
48+
<div class="title">Figure 160. The "Home" view for a Git repository in Visual Studio.</div>
49+
</div>
50+
<div class="paragraph">
51+
<p>Visual Studio now has a powerful task-focused UI for Git.
52+
It includes a linear history view, a diff viewer, remote commands, and many other capabilities.
53+
For complete documentation of this feature (which doesn’t fit here), go to <a href="http://msdn.microsoft.com/en-us/library/hh850437.aspx" class="bare">http://msdn.microsoft.com/en-us/library/hh850437.aspx</a>.</p>
54+
</div>
55+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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: uz
9+
chapter:
10+
title: 'Appendix A: Git in Other Environments'
11+
number: 1
12+
section:
13+
title: Git in Zsh
14+
number: 5
15+
cs_number: A1.5
16+
previous: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Bash
17+
next: book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Powershell
18+
title: Git - Git in Zsh
19+
url: "/book/uz/v2/Appendix-A:-Git-in-Other-Environments-Git-in-Zsh.html"
20+
---
21+
<h2 id="_git_in_zsh">Git in Zsh</h2>
22+
<div class="paragraph">
23+
<p>
24+
Git also ships with a tab-completion library for Zsh.
25+
Just copy <code>contrib/completion/git-completion.zsh</code> to your home directory and source it from your <code>.zshrc</code>.
26+
Zsh’s interface is a bit more powerful than Bash’s:</p>
27+
</div>
28+
<div class="listingblock">
29+
<div class="content">
30+
<pre class="highlight"><code class="language-console" data-lang="console">$ git che&lt;tab&gt;
31+
check-attr -- display gitattributes information
32+
check-ref-format -- ensure that a reference name is well formed
33+
checkout -- checkout branch or paths to working tree
34+
checkout-index -- copy files from index to working directory
35+
cherry -- find commits not merged upstream
36+
cherry-pick -- apply changes introduced by some existing commits</code></pre>
37+
</div>
38+
</div>
39+
<div class="paragraph">
40+
<p>Ambiguous tab-completions aren’t just listed; they have helpful descriptions, and you can graphically navigate the list by repeatedly hitting tab.
41+
This works with Git commands, their arguments, and names of things inside the repository (like refs and remotes), as well filenames and all the other things Zsh knows how to tab-complete.</p>
42+
</div>
43+
<div class="paragraph">
44+
<p>Zsh happens to be fairly compatible with Bash when it comes to prompt customization, but it allows you to have a right-side prompt as well.
45+
To include the branch name on the right side, add these lines to your <code>~/.zshrc</code> file:</p>
46+
</div>
47+
<div class="listingblock">
48+
<div class="content">
49+
<pre class="highlight"><code class="language-console" data-lang="console">setopt prompt_subst
50+
. ~/git-prompt.sh
51+
export RPROMPT=$'$(__git_ps1 "%s")'</code></pre>
52+
</div>
53+
</div>
54+
<div class="paragraph">
55+
<p>This results in a display of the current branch on the right-hand side of the terminal window, whenever your shell is inside a Git repository. It looks a bit like this:</p>
56+
</div>
57+
<div class="imageblock">
58+
<div class="content">
59+
<img src="{{< relurl "book/uz/v2/images/zsh-prompt.png" >}}" alt="Customized `zsh` prompt.">
60+
</div>
61+
<div class="title">Figure 163. Customized <code>zsh</code> prompt.</div>
62+
</div>
63+
<div class="paragraph">
64+
<p>Zsh is powerful enough that there are entire frameworks dedicated to making it better.
65+
One of them is called "oh-my-zsh", and it can be found at <a href="https://github.com/robbyrussell/oh-my-zsh" class="bare">https://github.com/robbyrussell/oh-my-zsh</a>.
66+
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.
67+
<a href="{{< relurl "book/uz/v2/ch00/oh_my_zsh_git" >}}">An example of an oh-my-zsh theme.</a> is just one example of what can be done with this system.</p>
68+
</div>
69+
<div id="oh_my_zsh_git" class="imageblock">
70+
<div class="content">
71+
<img src="{{< relurl "book/uz/v2/images/zsh-oh-my.png" >}}" alt="An example of an oh-my-zsh theme.">
72+
</div>
73+
<div class="title">Figure 164. An example of an oh-my-zsh theme.</div>
74+
</div>
75+
<div id="nav"><a href="{{< previous-section >}}">prev</a> | <a href="{{< next-section >}}">next</a></div>

0 commit comments

Comments
 (0)