Skip to content

Commit 78911f4

Browse files
committed
Merge remote-tracking branch 'origin/master' into chapter-7
Conflicts: book/07-git-tools/1-git-tools.asc
2 parents 53a2985 + 01f2552 commit 78911f4

File tree

6 files changed

+222
-510
lines changed

6 files changed

+222
-510
lines changed

OUTLINE.txt

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@
4242
* Limiting Log Output
4343
* Using a GUI to Visualize History
4444
2.4 Undoing Things
45-
* Reset Demystified
46-
* The Three Trees
47-
* The Workflow
48-
* The Role of Reset
49-
* Reset With a Path
50-
* A Fun Example
51-
* Check It Out
52-
* Summary
5345
* Changing Your Last Commit
5446
* Unstaging a Staged File
5547
* Unmodifying a Modified File
@@ -88,7 +80,7 @@
8880
* Topic Branches
8981
3.5 Remote Branches
9082
* Pushing
91-
* Tracking Branches
83+
* Tracking / Upstream Branches
9284
* Deleting Remote Branches
9385
3.6 Rebasing
9486
* The Basic Rebase
@@ -111,16 +103,7 @@
111103
4.4 Setting Up the Server
112104
4.5 Public Access
113105
4.6 GitWeb
114-
4.9 Git Daemon
115-
4.8 Gitolite
116-
* Installing
117-
* Customising the Install
118-
* Config File and Access Control Rules
119-
* Advanced Access Control with "deny" rules
120-
* Restricting pushes by files changed
121-
* Personal Branches
122-
* "Wildcard" repositories
123-
* Other Features
106+
4.7 Git Daemon
124107
4.X GitLab
125108
4.X Gerrit
126109
4.10 Other Hosting Options (bitbucket, stash, kiln, etc.)
@@ -198,14 +181,19 @@ X.X Summary
198181
* Double Dot
199182
* Multiple Points
200183
* Triple Dot
201-
6.2 Interactive Staging
202-
* Staging and Unstaging Files
203-
* Staging Patches
204-
6.3 Stashing
184+
6.3 Stashing and Cleaning
205185
* Stashing Your Work
206186
* Un-applying a Stash
207187
* Creating a Branch from a Stash
188+
* Git Clean
208189
6.X Searching (git grep)
190+
6.2 Interactive Staging
191+
* Staging and Unstaging Files
192+
* Staging Patches
193+
6.X Git Reset
194+
* The Three Trees of Git
195+
* Reset with a path
196+
* Reset vs Checkout
209197
6.4 Rewriting History
210198
* Changing the Last Commit
211199
* Changing Multiple Commit Messages

book/01-introduction/1-introduction.asc

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[[_getting_started]]
12
== Getting Started
23

34
This chapter will be about getting started with Git.
@@ -6,7 +7,7 @@ At the end of this chapter you should understand why Git is around, why you shou
67

78
=== About Version Control (((version control)))
89

9-
What is ((("version control"))), and why should you care?
10+
What is "version control", and why should you care?
1011
Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
1112
For the examples in this book you will use software source code as the files being version controlled, though in reality you can do this with nearly any type of file on a computer.
1213

@@ -34,7 +35,7 @@ RCS works by keeping patch sets (that is, the differences between files) in a sp
3435

3536
The next major issue that people encounter is that they need to collaborate with developers on other systems.
3637
To deal with this problem, Centralized Version Control Systems (CVCSs) were developed.
37-
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.
38+
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)))
3839
For many years, this has been the standard for version control.
3940

4041
.Centralized version control.
@@ -67,19 +68,19 @@ This allows you to set up several types of workflows that aren’t possible in c
6768

6869
As with many great things in life, Git began with a bit of creative destruction and fiery controversy.
6970

70-
The Linux kernel is an open source software project of fairly large scope.
71+
The Linux kernel is an open source software project of fairly large scope.(((Linux)))
7172
For most of the lifetime of the Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and archived files.
72-
In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.
73+
In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.(((BitKeeper)))
7374

7475
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.
75-
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.
76+
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)))
7677
Some of the goals of the new system were as follows:
7778

7879
* Speed
7980
* Simple design
8081
* Strong support for non-linear development (thousands of parallel branches)
8182
* Fully distributed
82-
* Able to handle large projects like the Linux kernel efficiently (speed and data size)
83+
* Able to handle large projects like the Linux kernel efficiently (speed and data size)(((Linux)))
8384

8485
Since its birth in 2005, Git has evolved and matured to be easy to use and yet retain these initial qualities.
8586
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>>).
@@ -89,7 +90,7 @@ It’s incredibly fast, it’s very efficient with large projects, and it has an
8990
So, what is Git in a nutshell?
9091
This is an important section to absorb, because if you understand what Git is and the fundamentals of how it works, then using Git effectively will probably be much easier for you.
9192
As you learn Git, try to clear your mind of the things you may know about other VCSs, such as Subversion and Perforce; doing so will help you avoid subtle confusion when using the tool.
92-
Git stores and thinks about information much differently than these other systems, even though the user interface is fairly similar, and understanding those differences will help prevent you from becoming confused while using it.
93+
Git stores and thinks about information much differently than these other systems, even though the user interface is fairly similar, and understanding those differences will help prevent you from becoming confused while using it.(((Subversion)))(((Perforce)))
9394

9495
==== Snapshots, Not Differences
9596

@@ -138,7 +139,7 @@ This means it’s impossible to change the contents of any file or directory wit
138139
This functionality is built into Git at the lowest levels and is integral to its philosophy.
139140
You can’t lose information in transit or get file corruption without Git being able to detect it.
140141

141-
The mechanism that Git uses for this checksumming is called a SHA-1 hash.
142+
The mechanism that Git uses for this checksumming is called a SHA-1 hash.(((SHA-1)))
142143
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.
143144
A SHA-1 hash looks something like this:
144145

@@ -208,23 +209,23 @@ Before you start using Git, you have to make it available on your computer.
208209
Even if it's already installed, it's probably a good idea to update to the latest version.
209210
You can either install it as a package or via another installer, or download the source code and compile it yourself.
210211

211-
==== Installing on Linux
212+
==== Installing on Linux(((Linux, installing)))
212213

213214
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.
214-
If you’re on Fedora, you can use yum:
215+
If you’re on Fedora for example, you can use yum:
215216

216217
$ yum install git
217218

218-
Or if you’re on a Debian-based distribution like Ubuntu, try apt-get:
219+
If you’re on a Debian-based distribution like Ubuntu, try apt-get:
219220

220221
$ apt-get install git
221222

222223
For more options, there are instructions for installing on several different Unix flavors on the Git website, at http://git-scm.com/download/linux[].
223224

224-
==== Installing on Mac
225+
==== Installing on Mac(((Mac, installing)))
225226

226227
There are several ways to install Git on a Mac.
227-
The easiest is probably to install the Xcode Command Line Tools.
228+
The easiest is probably to install the Xcode Command Line Tools.(((Xcode)))
228229
On Mavericks (10.9) or above you can do this simply by trying to run 'git' from the Terminal the very first time.
229230
If you don't have it installed already, it will prompt you to install it.
230231

@@ -240,37 +241,16 @@ You can download that tool from the GitHub for Mac website, at http://mac.github
240241

241242
==== Installing on Windows
242243

243-
There are also a few ways to install Git on Windows.
244+
There are also a few ways to install Git on Windows.(((Windows, installing)))
244245
The most official build is available for download on the Git website.
245246
Just go to http://git-scm.com/download/win[] and the download will start automatically.
246247
Note that this is a project called Git for Windows (also called msysGit), which is separate from Git itself; for more information on it, go to http://msysgit.github.io/[].
247248

248-
249249
Another easy way to get Git installed is by installing GitHub for Windows.
250250
The installer includes a command line version of Git as well as the GUI.
251251
It also works well with Powershell, and sets up solid credential caching and sane CRLF settings.
252252
We'll learn more about those things a little later, but suffice it to say they're things you want.
253253

254-
=== First-Time Git Setup
255-
256-
Now that you have Git on your system, you’ll want to do a few things to customize your Git environment.
257-
You should have to do these things only once on any given computer; they’ll stick around between upgrades.
258-
You can also change them at any time by running through the commands again.
259-
260-
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.
261-
These variables can be stored in three different places:
262-
263-
1. `/etc/gitconfig` file: Contains values for every user on the system and all their repositories.
264-
If you pass the option` --system` to `git config`, it reads and writes from this file specifically.
265-
2. `~/.gitconfig` or `~/.config/git/config` file: Specific to your user.
266-
You can make Git read and write to this file specifically by passing the `--global` option.
267-
3. `config` file in the Git directory (that is, `.git/config`) of whatever repository you’re currently using: Specific to that single repository.
268-
269-
Each level overrides values in the previous level, so values in `.git/config` trump those in `/etc/gitconfig`.
270-
271-
On Windows systems, Git looks for the `.gitconfig` file in the `$HOME` directory (`C:\Users\$USER` for most people).
272-
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.
273-
274254
==== Installing from Source
275255

276256
Some people may instead find it useful to install Git from source, because you’ll get the most recent version.
@@ -302,27 +282,53 @@ After this is done, you can also get Git via Git itself for updates:
302282

303283
$ git clone git://git.kernel.org/pub/scm/git/git.git
304284

285+
286+
=== First-Time Git Setup
287+
288+
Now that you have Git on your system, you’ll want to do a few things to customize your Git environment.
289+
You should have to do these things only once on any given computer; they’ll stick around between upgrades.
290+
You can also change them at any time by running through the commands again.
291+
292+
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, config)))
293+
These variables can be stored in three different places:
294+
295+
1. `/etc/gitconfig` file: Contains values for every user on the system and all their repositories.
296+
If you pass the option` --system` to `git config`, it reads and writes from this file specifically.
297+
2. `~/.gitconfig` or `~/.config/git/config` file: Specific to your user.
298+
You can make Git read and write to this file specifically by passing the `--global` option.
299+
3. `config` file in the Git directory (that is, `.git/config`) of whatever repository you’re currently using: Specific to that single repository.
300+
301+
Each level overrides values in the previous level, so values in `.git/config` trump those in `/etc/gitconfig`.
302+
303+
On Windows systems, Git looks for the `.gitconfig` file in the `$HOME` directory (`C:\Users\$USER` for most people).
304+
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.
305+
305306
==== Your Identity
306307

307308
The first thing you should do when you install Git is to set your user name and e-mail address.
308-
This is important because every Git commit uses this information, and it’s immutably baked into the commits you pass around:
309+
This is important because every Git commit uses this information, and it’s immutably baked into the commits you start creating:
309310

310311
$ git config --global user.name "John Doe"
311312
$ git config --global user.email [email protected]
312313

313314
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.
314315
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.
315316

316-
Many of the GUI tools will help you do this when you first run them as well.
317+
Many of the GUI tools will help you do this when you first run them.
317318

318319
==== Your Editor
319320

320321
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.
321-
By default, Git uses your system’s default editor, which is generally vi or Vim.
322+
If not configured, Git uses your system’s default editor, which is generally Vim.
322323
If you want to use a different text editor, such as Emacs, you can do the following:
323324

324325
$ git config --global core.editor emacs
325326

327+
[NOTE]
328+
====
329+
Vim and Emacs are popular text editors often used by developers on Unix based systems like Linux and Mac. If you are not familiar with either of these editors or are on a Windows system, you may need to search for instructions for how to set up your favorite editor with Git.
330+
====
331+
326332
==== Checking Your Settings
327333

328334
If you want to check your settings, you can use the `git config --list` command to list all the settings Git can find at that point:
@@ -339,7 +345,7 @@ If you want to check your settings, you can use the `git config --list` command
339345
You may see keys more than once, because Git reads the same key from different files (`/etc/gitconfig` and `~/.gitconfig`, for example).
340346
In this case, Git uses the last value for each unique key it sees.
341347

342-
You can also check what Git thinks a specific key’s value is by typing `git config <key>`:
348+
You can also check what Git thinks a specific key’s value is by typing `git config <key>`:(((git, config)))
343349

344350
$ git config user.name
345351
John Doe
@@ -352,16 +358,16 @@ If you ever need help while using Git, there are three ways to get the manual pa
352358
$ git <verb> --help
353359
$ man git-<verb>
354360

355-
For example, you can get the manpage help for the config command by running
361+
For example, you can get the manpage help for the config command by running(((git, help)))
356362

357363
$ git help config
358364

359365
These commands are nice because you can access them anywhere, even offline.
360366
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).
361-
These channels are regularly filled with hundreds of people who are all very knowledgeable about Git and are often willing to help.
367+
These channels are regularly filled with hundreds of people who are all very knowledgeable about Git and are often willing to help.(((IRC)))
362368

363369
=== Summary
364370

365-
You should have a basic understanding of what Git is and how it’s different from the CVCS you may have been using.
371+
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.
366372
You should also now have a working version of Git on your system that’s set up with your personal identity.
367373
It’s now time to learn some Git basics.

0 commit comments

Comments
 (0)