Skip to content

Commit bd2995b

Browse files
committedOct 7, 2014
Merge remote-tracking branch 'origin/master' into appendix
Conflicts: book/10-git-internals/sections/refs.asc
2 parents e3fe829 + 82e973f commit bd2995b

39 files changed

+873
-560
lines changed
 

‎book/01-introduction/1-introduction.asc

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ include::sections/help.asc[]
2121

2222
=== Summary
2323

24-
You should have a basic understanding of what Git is and how its different from the centralized version control system you may have previously been using.
25-
You should also now have a working version of Git on your system thats set up with your personal identity.
26-
Its now time to learn some Git basics.
24+
You should have a basic understanding of what Git is and how it's different from the centralized version control system you may have previously been using.
25+
You should also now have a working version of Git on your system that's set up with your personal identity.
26+
It's now time to learn some Git basics.

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

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ In addition, you get all this for very little overhead.
1313
==== Local Version Control Systems
1414

1515
(((version control,local)))
16-
Many peoples version-control method of choice is to copy files into another directory (perhaps a time-stamped directory, if theyre clever).
16+
Many people's version-control method of choice is to copy files into another directory (perhaps a time-stamped directory, if they're clever).
1717
This approach is very common because it is so simple, but it is also incredibly error prone.
18-
It is easy to forget which directory youre in and accidentally write to the wrong file or copy over files you dont mean to.
18+
It is easy to forget which directory you're in and accidentally write to the wrong file or copy over files you don't mean to.
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

@@ -39,24 +39,24 @@ image::images/centralized.png[Centralized version control diagram]
3939

4040
This setup offers many advantages, especially over local VCSs.
4141
For example, everyone knows to a certain degree what everyone else on the project is doing.
42-
Administrators have fine-grained control over who can do what; and its far easier to administer a CVCS than it is to deal with local databases on every client.
42+
Administrators have fine-grained control over who can do what; and it's far easier to administer a CVCS than it is to deal with local databases on every client.
4343

4444
However, this setup also has some serious downsides.
4545
The most obvious is the single point of failure that the centralized server represents.
46-
If that server goes down for an hour, then during that hour nobody can collaborate at all or save versioned changes to anything theyre working on.
47-
If the hard disk the central database is on becomes corrupted, and proper backups havent been kept, you lose absolutely everything – the entire history of the project except whatever single snapshots people happen to have on their local machines.
46+
If that server goes down for an hour, then during that hour nobody can collaborate at all or save versioned changes to anything they're working on.
47+
If the hard disk the central database is on becomes corrupted, and proper backups haven't been kept, you lose absolutely everything – the entire history of the project except whatever single snapshots people happen to have on their local machines.
4848
Local VCS systems suffer from this same problem – whenever you have the entire history of the project in a single place, you risk losing everything.
4949

5050
==== Distributed Version Control Systems
5151

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

5858
.Distributed version control.
5959
image::images/distributed.png[Distributed version control diagram]
6060

6161
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.
62-
This allows you to set up several types of workflows that arent possible in centralized systems, such as hierarchical models.
62+
This allows you to set up several types of workflows that aren't possible in centralized systems, such as hierarchical models.

‎book/01-introduction/sections/basics.asc

+16-16
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ These systems (CVS, Subversion, Perforce, Bazaar, and so on) think of the inform
1414
.Storing data as changes to a base version of each file.
1515
image::images/deltas.png[Storing data as changes to a base version of each file.]
1616

17-
Git doesnt think of or store its data this way.
17+
Git doesn't think of or store its data this way.
1818
Instead, Git thinks of its data more like a set of snapshots of a miniature filesystem.
1919
Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot.
20-
To be efficient, if files have not changed, Git doesnt store the file again, just a link to the previous identical file it has already stored.
20+
To be efficient, if files have not changed, Git doesn't store the file again, just a link to the previous identical file it has already stored.
2121
Git thinks about its data more like a *stream of snapshots*.
2222

2323
.Storing data as snapshots of the project over time.
@@ -26,31 +26,31 @@ image::images/snapshots.png[Git stores data as snapshots of the project over tim
2626
This is an important distinction between Git and nearly all other VCSs.
2727
It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation.
2828
This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.
29-
Well explore some of the benefits you gain by thinking of your data this way when we cover Git branching in <<_git_branching>>.
29+
We'll explore some of the benefits you gain by thinking of your data this way when we cover Git branching in <<_git_branching>>.
3030

3131
==== Nearly Every Operation Is Local
3232

3333
Most operations in Git only need local files and resources to operate – generally no information is needed from another computer on your network.
34-
If youre used to a CVCS where most operations have that network latency overhead, this aspect of Git will make you think that the gods of speed have blessed Git with unworldly powers.
34+
If you're used to a CVCS where most operations have that network latency overhead, this aspect of Git will make you think that the gods of speed have blessed Git with unworldly powers.
3535
Because you have the entire history of the project right there on your local disk, most operations seem almost instantaneous.
3636

37-
For example, to browse the history of the project, Git doesnt need to go out to the server to get the history and display it for you – it simply reads it directly from your local database.
37+
For example, to browse the history of the project, Git doesn't need to go out to the server to get the history and display it for you – it simply reads it directly from your local database.
3838
This means you see the project history almost instantly.
3939
If you want to see the changes introduced between the current version of a file and the file a month ago, Git can look up the file a month ago and do a local difference calculation, instead of having to either ask a remote server to do it or pull an older version of the file from the remote server to do it locally.
4040

41-
This also means that there is very little you cant do if youre offline or off VPN.
41+
This also means that there is very little you can't do if you're offline or off VPN.
4242
If you get on an airplane or a train and want to do a little work, you can commit happily until you get to a network connection to upload.
43-
If you go home and cant get your VPN client working properly, you can still work.
43+
If you go home and can't get your VPN client working properly, you can still work.
4444
In many other systems, doing so is either impossible or painful.
45-
In Perforce, for example, you cant do much when you arent connected to the server; and in Subversion and CVS, you can edit files, but you cant commit changes to your database (because your database is offline).
45+
In Perforce, for example, you can't do much when you aren't connected to the server; and in Subversion and CVS, you can edit files, but you can't commit changes to your database (because your database is offline).
4646
This may not seem like a huge deal, but you may be surprised what a big difference it can make.
4747

4848
==== Git Has Integrity
4949

5050
Everything in Git is check-summed before it is stored and is then referred to by that checksum.
51-
This means its impossible to change the contents of any file or directory without Git knowing about it.
51+
This means it's impossible to change the contents of any file or directory without Git knowing about it.
5252
This functionality is built into Git at the lowest levels and is integral to its philosophy.
53-
You cant lose information in transit or get file corruption without Git being able to detect it.
53+
You can't lose information in transit or get file corruption without Git being able to detect it.
5454

5555
The mechanism that Git uses for this checksumming is called a SHA-1 hash.(((SHA-1)))
5656
This is a 40-character string composed of hexadecimal characters (0–9 and a–f) and calculated based on the contents of a file or directory structure in Git.
@@ -65,10 +65,10 @@ In fact, Git stores everything in its database not by file name but by the hash
6565

6666
When you do actions in Git, nearly all of them only add data to the Git database.
6767
It is hard to get the system to do anything that is not undoable or to make it erase data in any way.
68-
As in any VCS, you can lose or mess up changes you havent committed yet; but after you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository.
68+
As in any VCS, you can lose or mess up changes you haven't committed yet; but after you commit a snapshot into Git, it is very difficult to lose, especially if you regularly push your database to another repository.
6969

7070
This makes using Git a joy because we know we can experiment without the danger of severely screwing things up.
71-
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<_git_objects>>.
71+
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<_undoing>>.
7272

7373
==== The Three States
7474

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

9393
The staging area is a file, generally contained in your Git directory, that stores information about what will go into your next commit.
94-
Its sometimes referred to as the ``index'', but its also common to refer to it as the staging area.
94+
It's sometimes referred to as the ``index'', but it's also common to refer to it as the staging area.
9595

9696
The basic Git workflow goes something like this:
9797

9898
1. You modify files in your working directory.
9999
2. You stage the files, adding snapshots of them to your staging area.
100100
3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
101101

102-
If a particular version of a file is in the Git directory, its considered committed.
103-
If its modified but has been added to the staging area, it is staged.
102+
If a particular version of a file is in the Git directory, it's considered committed.
103+
If it's modified but has been added to the staging area, it is staged.
104104
And if it was changed since it was checked out but has not been staged, it is modified.
105-
In <<_git_basics_chapter>>, youll learn more about these states and how you can either take advantage of them or skip the staged part entirely.
105+
In <<_git_basics_chapter>>, you'll learn more about these states and how you can either take advantage of them or skip the staged part entirely.

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== First-Time Git Setup
22

3-
Now that you have Git on your system, youll want to do a few things to customize your Git environment.
4-
You should have to do these things only once on any given computer; theyll stick around between upgrades.
3+
Now that you have Git on your system, you'll want to do a few things to customize your Git environment.
4+
You should have to do these things only once on any given computer; they'll stick around between upgrades.
55
You can also change them at any time by running through the commands again.
66

77
Git comes with a tool called `git config` that lets you get and set configuration variables that control all aspects of how Git looks and operates.(((git commands, config)))
@@ -11,30 +11,30 @@ These variables can be stored in three different places:
1111
If you pass the option `--system` to `git config`, it reads and writes from this file specifically.
1212
2. `~/.gitconfig` or `~/.config/git/config` file: Specific to your user.
1313
You can make Git read and write to this file specifically by passing the `--global` option.
14-
3. `config` file in the Git directory (that is, `.git/config`) of whatever repository youre currently using: Specific to that single repository.
14+
3. `config` file in the Git directory (that is, `.git/config`) of whatever repository you're currently using: Specific to that single repository.
1515
1616
Each level overrides values in the previous level, so values in `.git/config` trump those in `/etc/gitconfig`.
1717

1818
On Windows systems, Git looks for the `.gitconfig` file in the `$HOME` directory (`C:\Users\$USER` for most people).
19-
It also still looks for `/etc/gitconfig`, although its relative to the MSys root, which is wherever you decide to install Git on your Windows system when you run the installer.
19+
It also still looks for `/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.
2020

2121
==== Your Identity
2222

2323
The first thing you should do when you install Git is to set your user name and e-mail address.
24-
This is important because every Git commit uses this information, and its immutably baked into the commits you start creating:
24+
This is important because every Git commit uses this information, and it's immutably baked into the commits you start creating:
2525

2626
$ git config --global user.name "John Doe"
2727
$ git config --global user.email johndoe@example.com
2828

2929
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.
30-
If you want to override this with a different name or e-mail address for specific projects, you can run the command without the `--global` option when youre in that project.
30+
If you want to override this with a different name or e-mail address for specific projects, you can run the command without the `--global` option when you're in that project.
3131

3232
Many of the GUI tools will help you do this when you first run them.
3333

3434
==== Your Editor
3535

3636
Now that your identity is set up, you can configure the default text editor that will be used when Git needs you to type in a message.
37-
If not configured, Git uses your systems default editor, which is generally Vim.
37+
If not configured, Git uses your system's default editor, which is generally Vim.
3838
If you want to use a different text editor, such as Emacs, you can do the following:
3939

4040
$ git config --global core.editor emacs
@@ -60,7 +60,7 @@ If you want to check your settings, you can use the `git config --list` command
6060
You may see keys more than once, because Git reads the same key from different files (`/etc/gitconfig` and `~/.gitconfig`, for example).
6161
In this case, Git uses the last value for each unique key it sees.
6262

63-
You can also check what Git thinks a specific keys value is by typing `git config <key>`:(((git commands, config)))
63+
You can also check what Git thinks a specific key's value is by typing `git config <key>`:(((git commands, config)))
6464

6565
$ git config user.name
6666
John Doe

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ For example, you can get the manpage help for the config command by running(((gi
1212
$ git help config
1313

1414
These commands are nice because you can access them anywhere, even offline.
15-
If the manpages and this book arent enough and you need in-person help, you can try the `#git` or `#github` channel on the Freenode IRC server (irc.freenode.net).
15+
If the manpages and this book aren't enough and you need in-person help, you can try the `#git` or `#github` channel on the Freenode IRC server (irc.freenode.net).
1616
These channels are regularly filled with hundreds of people who are all very knowledgeable about Git and are often willing to help.(((IRC)))

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The Linux kernel is an open source software project of fairly large scope.(((Lin
66
For most of the lifetime of the Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and archived files.
77
In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.(((BitKeeper)))
88

9-
In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down, and the tools free-of-charge status was revoked.
9+
In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down, and the tool's free-of-charge status was revoked.
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

@@ -17,4 +17,4 @@ Some of the goals of the new system were as follows:
1717
* 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-
Its incredibly fast, its very efficient with large projects, and it has an incredible branching system for non-linear development (See <<_git_branching>>).
20+
It's incredibly fast, it's very efficient with large projects, and it has an incredible branching system for non-linear development (See <<_git_branching>>).

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ This book was written using Git version *2.0.0*. Though most of the commands we
1313

1414
(((Linux, installing)))
1515
If you want to install Git on Linux via a binary installer, you can generally do so through the basic package-management tool that comes with your distribution.
16-
If youre on Fedora for example, you can use yum:
16+
If you're on Fedora for example, you can use yum:
1717

1818
$ yum install git
1919

20-
If youre on a Debian-based distribution like Ubuntu, try apt-get:
20+
If you're on a Debian-based distribution like Ubuntu, try apt-get:
2121

2222
$ apt-get install git
2323

@@ -57,11 +57,11 @@ You can download this from the GitHub for Windows website, at http://windows.git
5757

5858
==== Installing from Source
5959

60-
Some people may instead find it useful to install Git from source, because youll get the most recent version.
60+
Some people may instead find it useful to install Git from source, because you'll get the most recent version.
6161
The binary installers tend to be a bit behind, though as Git has matured in recent years, this has made less of a difference.
6262

6363
If you do want to install Git from source, you need to have the following libraries that Git depends on: curl, zlib, openssl, expat, and libiconv.
64-
For example, if youre on a system that has yum (such as Fedora) or apt-get (such as a Debian based system), you can use one of these commands to install all of the dependencies:
64+
For example, if you're on a system that has yum (such as Fedora) or apt-get (such as a Debian based system), you can use one of these commands to install all of the dependencies:
6565

6666
$ yum install curl-devel expat-devel gettext-devel \
6767
openssl-devel zlib-devel

0 commit comments

Comments
 (0)
Please sign in to comment.