Skip to content

Commit 4b38e75

Browse files
Cópia do diretório book da revisão ece0b7f
1 parent e30df8c commit 4b38e75

71 files changed

Lines changed: 405 additions & 375 deletions

Some content is hidden

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

book-en/01-introduction/sections/about-version-control.asc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,21 @@ It is easy to forget which directory you're in and accidentally write to the wro
1919

2020
To deal with this issue, programmers long ago developed local VCSs that had a simple database that kept all the changes to files under revision control.
2121

22-
.Local version control
22+
.Local version control diagram
2323
image::images/local.png[Local version control diagram]
2424

2525
One of the most popular VCS tools was a system called RCS, which is still distributed with many computers today.
26-
https://www.gnu.org/software/rcs/[RCS] works by keeping patch sets (that is, the differences between files) in a special format on disk; it can then re-create what any file looked like at any point in time by adding up all the patches.
26+
https://www.gnu.org/software/rcs/[RCS^] works by keeping patch sets (that is, the differences between files) in a special format on disk; it can then re-create what any file looked like at any point in time by adding up all the patches.
2727

2828
==== Centralized Version Control Systems
2929

3030
(((version control,centralized)))
3131
The next major issue that people encounter is that they need to collaborate with developers on other systems.
3232
To deal with this problem, Centralized Version Control Systems (CVCSs) were developed.
33-
These systems (such as CVS, Subversion, and Perforce) have a single server that contains all the versioned files, and a number of clients that check out files from that central place. (((CVS)))(((Subversion)))(((Perforce)))
33+
These systems (such as CVS, Subversion, and Perforce) have a single server that contains all the versioned files, and a number of clients that check out files from that central place.(((CVS)))(((Subversion)))(((Perforce)))
3434
For many years, this has been the standard for version control.
3535

36-
.Centralized version control
36+
.Centralized version control diagram
3737
image::images/centralized.png[Centralized version control diagram]
3838

3939
This setup offers many advantages, especially over local VCSs.
@@ -50,11 +50,11 @@ Local VCSs suffer from this same problem -- whenever you have the entire history
5050

5151
(((version control,distributed)))
5252
This is where Distributed Version Control Systems (DVCSs) step in.
53-
In a DVCS (such as Git, Mercurial, Bazaar or Darcs), clients don't just check out the latest snapshot of the files; rather, they fully mirror the repository, including its full history.
53+
In a DVCS (such as Git, Mercurial or Darcs), clients don't just check out the latest snapshot of the files; rather, they fully mirror the repository, including its full history.
5454
Thus, if any server dies, and these systems were collaborating via that server, any of the client repositories can be copied back up to the server to restore it.
5555
Every clone is really a full backup of all the data.
5656

57-
.Distributed version control
57+
.Distributed version control diagram
5858
image::images/distributed.png[Distributed version control diagram]
5959

6060
Furthermore, many of these systems deal pretty well with having several remote repositories they can work with, so you can collaborate with different groups of people in different ways simultaneously within the same project.

book-en/01-introduction/sections/first-time-setup.asc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ Each level overrides values in the previous level, so values in `.git/config` tr
2121

2222
On Windows systems, Git looks for the `.gitconfig` file in the `$HOME` directory (`C:\Users\$USER` for most people).
2323
It also still looks for `[path]/etc/gitconfig`, although it's relative to the MSys root, which is wherever you decide to install Git on your Windows system when you run the installer.
24-
If you are using version 2.x or later of Git for Windows, there is also a system-level config file at
25-
`C:\Documents and Settings\All Users\Application Data\Git\config` on Windows XP, and in `C:\ProgramData\Git\config` on Windows Vista and newer.
24+
If you are using version 2.x or later of Git for Windows, there is also a system-level config file at `C:\Documents and Settings\All Users\Application Data\Git\config` on Windows XP, and in `C:\ProgramData\Git\config` on Windows Vista and newer.
2625
This config file can only be changed by `git config -f <file>` as an admin.
2726

2827
You can view all of your settings and where they are coming from using:
@@ -43,7 +42,7 @@ $ git config --global user.name "John Doe"
4342
$ git config --global user.email johndoe@example.com
4443
----
4544

46-
Again, you need to do this only once if you pass the `--global` option, because then Git will always use that information for anything you do on that system.
45+
Again, you need to do this only once if you pass the `--global` option, because then Git will always use that information for your user on that system.
4746
If you want to override this with a different name or email address for specific projects, you can run the command without the `--global` option when you're in that project.
4847

4948
Many of the GUI tools will help you do this when you first run them.
@@ -84,6 +83,7 @@ You may find, if you don't setup your editor like this, you get into a really co
8483
An example on a Windows system may include a prematurely terminated Git operation during a Git initiated edit.
8584
====
8685

86+
[[_new_default_branch]]
8787
==== Your default branch name
8888

8989
By default Git will create a branch called _master_ when you create a new repository with `git init`.

book-en/01-introduction/sections/help.asc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ git help config
1818
----
1919

2020
These commands are nice because you can access them anywhere, even offline.
21-
If the manpages and this book aren't enough and you need in-person help, you can try the `#git`, `#github`, or `#gitlab` channels on the Libera Chat IRC server, which can be found at https://libera.chat/[].
21+
If the manpages and this book aren't enough and you need in-person help, you can try the `#git`, `#github`, or `#gitlab` channels on the Libera Chat IRC server, which can be found at https://libera.chat/[^].
2222
These channels are regularly filled with hundreds of people who are all very knowledgeable about Git and are often willing to help.(((IRC)))
2323

2424
In addition, if you don't need the full-blown manpage help, but just need a quick refresher on the available options for a Git command, you can ask for the more concise "`help`" output with the `-h` option, as in:
@@ -43,8 +43,8 @@ usage: git add [<options>] [--] <pathspec>...
4343
--refresh don't add, only refresh the index
4444
--ignore-errors just skip files which cannot be added because of errors
4545
--ignore-missing check if - even missing - files are ignored in dry run
46+
--sparse allow updating entries outside of the sparse-checkout cone
4647
--chmod (+|-)x override the executable bit of the listed files
4748
--pathspec-from-file <file> read pathspec from file
4849
--pathspec-file-nul with --pathspec-from-file, pathspec elements are separated with NUL character
4950
----
50-

book-en/01-introduction/sections/history.asc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ In 2005, the relationship between the community that developed the Linux kernel
1010
This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool based on some of the lessons they learned while using BitKeeper.(((Linus Torvalds)))
1111
Some of the goals of the new system were as follows:
1212

13-
* Speed
14-
* Simple design
15-
* Strong support for non-linear development (thousands of parallel branches)
16-
* Fully distributed
17-
* Able to handle large projects like the Linux kernel efficiently (speed and data size)
13+
* Speed
14+
* Simple design
15+
* Strong support for non-linear development (thousands of parallel branches)
16+
* Fully distributed
17+
* Able to handle large projects like the Linux kernel efficiently (speed and data size)
1818
1919
Since its birth in 2005, Git has evolved and matured to be easy to use and yet retain these initial qualities.
20-
It's amazingly fast, it's very efficient with large projects, and it has an incredible branching system for non-linear development (See <<ch03-git-branching#ch03-git-branching>>).
20+
It's amazingly fast, it's very efficient with large projects, and it has an incredible branching system for non-linear development (see <<ch03-git-branching#ch03-git-branching>>).

book-en/01-introduction/sections/installing.asc

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ You can either install it as a package or via another installer, or download the
66

77
[NOTE]
88
====
9-
This book was written using Git version *2.8.0*.
10-
Though most of the commands we use should work even in ancient versions of Git, some of them might not or might act slightly differently if you're using an older version.
11-
Since Git is quite excellent at preserving backwards compatibility, any version after 2.8 should work just fine.
9+
This book was written using Git version 2.
10+
Since Git is quite excellent at preserving backwards compatibility, any recent version should work just fine.
11+
Though most of the commands we use should work even in ancient versions of Git, some of them might not or might act slightly differently.
1212
====
1313

1414
==== Installing on Linux
@@ -29,12 +29,12 @@ If you're on a Debian-based distribution, such as Ubuntu, try `apt`:
2929
$ sudo apt install git-all
3030
----
3131

32-
For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux[].
32+
For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux[^].
3333

3434
==== Installing on macOS
3535

3636
(((macOS, installing)))
37-
There are several ways to install Git on a Mac.
37+
There are several ways to install Git on macOS.
3838
The easiest is probably to install the Xcode Command Line Tools.(((Xcode)))
3939
On Mavericks (10.9) or above you can do this simply by trying to run `git` from the Terminal the very first time.
4040

@@ -46,19 +46,19 @@ $ git --version
4646
If you don't have it installed already, it will prompt you to install it.
4747

4848
If you want a more up to date version, you can also install it via a binary installer.
49-
A macOS Git installer is maintained and available for download at the Git website, at https://git-scm.com/download/mac[].
49+
A macOS Git installer is maintained and available for download at the Git website, at https://git-scm.com/download/mac[^].
5050

51-
.Git macOS Installer
51+
.Git macOS installer
5252
image::images/git-osx-installer.png[Git macOS installer]
5353

5454
==== Installing on Windows
5555

5656
There are also a few ways to install Git on Windows.(((Windows, installing)))
5757
The most official build is available for download on the Git website.
58-
Just go to https://git-scm.com/download/win[] and the download will start automatically.
59-
Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://gitforwindows.org[].
58+
Just go to https://git-scm.com/download/win[^] and the download will start automatically.
59+
Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://gitforwindows.org[^].
6060

61-
To get an automated installation you can use the https://chocolatey.org/packages/git[Git Chocolatey package].
61+
To get an automated installation you can use the https://community.chocolatey.org/packages/git[Git Chocolatey package^].
6262
Note that the Chocolatey package is community maintained.
6363

6464
==== Installing from Source
@@ -87,7 +87,7 @@ $ sudo apt-get install asciidoc xmlto docbook2x
8787

8888
[NOTE]
8989
====
90-
Users of RHEL and RHEL-derivatives like CentOS and Scientific Linux will have to https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F[enable the EPEL repository] to download the `docbook2X` package.
90+
Users of RHEL and RHEL-derivatives like CentOS and Scientific Linux will have to https://docs.fedoraproject.org/en-US/epel/#how_can_i_use_these_extra_packages[enable the EPEL repository^] to download the `docbook2X` package.
9191
====
9292

9393
If you're using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the `install-info` package:
@@ -114,7 +114,7 @@ $ sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi
114114
due to binary name differences.
115115

116116
When you have all the necessary dependencies, you can go ahead and grab the latest tagged release tarball from several places.
117-
You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git[], or the mirror on the GitHub website, at https://github.com/git/git/releases[].
117+
You can get it via the kernel.org site, at https://www.kernel.org/pub/software/scm/git[^], or the mirror on the GitHub website, at https://github.com/git/git/tags[^].
118118
It's generally a little clearer what the latest version is on the GitHub page, but the kernel.org page also has release signatures if you want to verify your download.
119119

120120
Then, compile and install:
@@ -133,5 +133,5 @@ After this is done, you can also get Git via Git itself for updates:
133133

134134
[source,console]
135135
----
136-
$ git clone git://git.kernel.org/pub/scm/git/git.git
136+
$ git clone https://git.kernel.org/pub/scm/git/git.git
137137
----

book-en/01-introduction/sections/what-is-git.asc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Even though Git's user interface is fairly similar to these other VCSs, Git stor
1010

1111
The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data.
1212
Conceptually, most other systems store information as a list of file-based changes.
13-
These other systems (CVS, Subversion, Perforce, Bazaar, and so on) think of the information they store as a set of files and the changes made to each file over time (this is commonly described as _delta-based_ version control).
13+
These other systems (CVS, Subversion, Perforce, and so on) think of the information they store as a set of files and the changes made to each file over time (this is commonly described as _delta-based_ version control).
1414

1515
.Storing data as changes to a base version of each file
1616
image::images/deltas.png[Storing data as changes to a base version of each file]
@@ -86,7 +86,7 @@ Git has three main states that your files can reside in: _modified_, _staged_, a
8686
This leads us to the three main sections of a Git project: the working tree, the staging area, and the Git directory.
8787

8888
.Working tree, staging area, and Git directory
89-
image::images/areas.png["Working tree, staging area, and Git directory."]
89+
image::images/areas.png["Working tree, staging area, and Git directory"]
9090

9191
The working tree is a single checkout of one version of the project.
9292
These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify.

book-en/02-git-basics/sections/recording-changes.asc

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ Finally, the command tells you which branch you're on and informs you that it ha
3636
For now, that branch is always `master`, which is the default; you won't worry about it here.
3737
<<ch03-git-branching#ch03-git-branching>> will go over branches and references in detail.
3838

39+
[NOTE]
40+
====
41+
GitHub changed the default branch name from `master` to `main` in mid-2020, and other Git hosts followed suit.
42+
So you may find that the default branch name in some newly created repositories is `main` and not `master`.
43+
In addition, the default branch name can be changed (as you have seen in <<ch01-getting-started#_new_default_branch>>), so you may see a different name for the default branch.
44+
45+
However, Git itself still uses `master` as the default, so we will use it throughout the book.
46+
====
47+
3948
Let's say you add a new file to your project, a simple `README` file.
4049
If the file didn't exist before, and you run `git status`, you see your untracked file like so:
4150

@@ -219,11 +228,11 @@ Setting up a `.gitignore` file for your new repository before you get going is g
219228

220229
The rules for the patterns you can put in the `.gitignore` file are as follows:
221230

222-
* Blank lines or lines starting with `#` are ignored.
223-
* Standard glob patterns work, and will be applied recursively throughout the entire working tree.
224-
* You can start patterns with a forward slash (`/`) to avoid recursivity.
225-
* You can end patterns with a forward slash (`/`) to specify a directory.
226-
* You can negate a pattern by starting it with an exclamation point (`!`).
231+
* Blank lines or lines starting with `#` are ignored.
232+
* Standard glob patterns work, and will be applied recursively throughout the entire working tree.
233+
* You can start patterns with a forward slash (`/`) to avoid recursivity.
234+
* You can end patterns with a forward slash (`/`) to specify a directory.
235+
* You can negate a pattern by starting it with an exclamation point (`!`).
227236

228237
Glob patterns are like simplified regular expressions that shells use.
229238
An asterisk (`\*`) matches zero or more characters; `[abc]` matches any character inside the brackets (in this case a, b, or c); a question mark (`?`) matches a single character; and brackets enclosing characters separated by a hyphen (`[0-9]`) matches any character between them (in this case 0 through 9).
@@ -254,7 +263,7 @@ doc/**/*.pdf
254263

255264
[TIP]
256265
====
257-
GitHub maintains a fairly comprehensive list of good `.gitignore` file examples for dozens of projects and languages at https://github.com/github/gitignore[] if you want a starting point for your project.
266+
GitHub maintains a fairly comprehensive list of good `.gitignore` file examples for dozens of projects and languages at https://github.com/github/gitignore[^] if you want a starting point for your project.
258267
====
259268

260269
[NOTE]
@@ -617,4 +626,4 @@ $ git add README
617626

618627
Git figures out that it's a rename implicitly, so it doesn't matter if you rename a file that way or with the `mv` command.
619628
The only real difference is that `git mv` is one command instead of three -- it's a convenience function.
620-
More importantly, you can use any tool you like to rename a file, and address the add/rm later, before you commit.
629+
More importantly, you can use any tool you like to rename a file, and address the `add`/`rm` later, before you commit.

book-en/02-git-basics/sections/remotes.asc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ pb https://github.com/paulboone/ticgit (fetch)
8787
pb https://github.com/paulboone/ticgit (push)
8888
----
8989

90-
Now you can use the string `pb` on the command line in lieu of the whole URL.
90+
Now you can use the string `pb` on the command line instead of the whole URL.
9191
For example, if you want to fetch all the information that Paul has but that you don't yet have in your repository, you can run `git fetch pb`:
9292

9393
[source,console]
@@ -129,10 +129,10 @@ Running `git pull` generally fetches data from the server you originally cloned
129129

130130
[NOTE]
131131
====
132-
From git version 2.27 onward, `git pull` will give a warning if the `pull.rebase` variable is not set.
132+
From Git version 2.27 onward, `git pull` will give a warning if the `pull.rebase` variable is not set.
133133
Git will keep warning you until you set the variable.
134134
135-
If you want the default behavior of git (fast-forward if possible, else create a merge commit):
135+
If you want the default behavior of Git (fast-forward if possible, else create a merge commit):
136136
`git config --global pull.rebase "false"`
137137
138138
If you want to rebase when pulling:

0 commit comments

Comments
 (0)