You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/01-introduction/sections/basics.asc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ image::images/snapshots.png[Git stores data as snapshots of the project over tim
26
26
This is an important distinction between Git and nearly all other VCSs.
27
27
It makes Git reconsider almost every aspect of version control that most other systems copied from the previous generation.
28
28
This makes Git more like a mini filesystem with some incredibly powerful tools built on top of it, rather than simply a VCS.
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#_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 <<ch03-git-branching#ch03-git-branching>>.
30
30
31
31
==== Nearly Every Operation Is Local
32
32
@@ -71,7 +71,7 @@ It is hard to get the system to do anything that is not undoable or to make it e
71
71
As with 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.
72
72
73
73
This makes using Git a joy because we know we can experiment without the danger of severely screwing things up.
74
-
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<_git_basics_chapter#_undoing>>.
74
+
For a more in-depth look at how Git stores its data and how you can recover data that seems lost, see <<ch02-git-basics-chapter#_undoing>>.
75
75
76
76
==== The Three States
77
77
@@ -105,4 +105,4 @@ The basic Git workflow goes something like this:
105
105
If a particular version of a file is in the Git directory, it's considered committed.
106
106
If it has been modified and was added to the staging area, it is staged.
107
107
And if it was changed since it was checked out but has not been staged, it is modified.
108
-
In <<_git_basics_chapter#_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.
108
+
In <<ch02-git-basics-chapter#ch02-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.
Copy file name to clipboardExpand all lines: book/01-introduction/sections/history.asc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,4 +17,4 @@ Some of the goals of the new system were as follows:
17
17
* Able to handle large projects like the Linux kernel efficiently (speed and data size)
18
18
19
19
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 <<_git_branching#_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>>).
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/getting-a-repository.asc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ $ git init
38
38
39
39
This creates a new subdirectory named `.git` that contains all of your necessary repository files -- a Git repository skeleton.
40
40
At this point, nothing in your project is tracked yet.
41
-
(See <<_git_internals#_git_internals>> for more information about exactly what files are contained in the `.git` directory you just created.)(((git commands, init)))
41
+
(See <<ch10-git-internals#ch10-git-internals>> for more information about exactly what files are contained in the `.git` directory you just created.)(((git commands, init)))
42
42
43
43
If you want to start version-controlling existing files (as opposed to an empty directory), you should probably begin tracking those files and do an initial commit.
44
44
You can accomplish that with a few `git add` commands that specify the files you want to track, followed by a `git commit`:
@@ -60,7 +60,7 @@ If you want to get a copy of an existing Git repository -- for example, a projec
60
60
If you're familiar with other VCS systems such as Subversion, you'll notice that the command is "clone" and not "checkout".
61
61
This is an important distinction -- instead of getting just a working copy, Git receives a full copy of nearly all data that the server has.
62
62
Every version of every file for the history of the project is pulled down by default when you run `git clone`.
63
-
In fact, if your server disk gets corrupted, you can often use nearly any of the clones on any client to set the server back to the state it was in when it was cloned (you may lose some server-side hooks and such, but all the versioned data would be there -- see <<_git_on_the_server#_getting_git_on_a_server>> for more details).
63
+
In fact, if your server disk gets corrupted, you can often use nearly any of the clones on any client to set the server back to the state it was in when it was cloned (you may lose some server-side hooks and such, but all the versioned data would be there -- see <<ch04-git-on-the-server#_getting_git_on_a_server>> for more details).
64
64
65
65
You clone a repository with `git clone <url>`.(((git commands, clone)))
66
66
For example, if you want to clone the Git linkable library called `libgit2`, you can do so like this:
@@ -84,4 +84,4 @@ That command does the same thing as the previous one, but the target directory i
84
84
85
85
Git has a number of different transfer protocols you can use.
86
86
The previous example uses the `https://` protocol, but you may also see `git://` or `user@server:path/to/repo.git`, which uses the SSH transfer protocol.
87
-
<<_git_on_the_server#_getting_git_on_a_server>> will introduce all of the available options the server can set up to access your Git repository and the pros and cons of each.
87
+
<<ch04-git-on-the-server#_getting_git_on_a_server>> will introduce all of the available options the server can set up to access your Git repository and the pros and cons of each.
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/recording-changes.asc
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ This means you have a clean working directory -- in other words, none of your tr
34
34
Git also doesn't see any untracked files, or they would be listed here.
35
35
Finally, the command tells you which branch you're on and informs you that it has not diverged from the same branch on the server.
36
36
For now, that branch is always ``master'', which is the default; you won't worry about it here.
37
-
<<_git_branching#_git_branching>> will go over branches and references in detail.
37
+
<<ch03-git-branching#ch03-git-branching>> will go over branches and references in detail.
38
38
39
39
Let's say you add a new file to your project, a simple `README` file.
40
40
If the file didn't exist before, and you run `git status`, you see your untracked file like so:
@@ -420,7 +420,7 @@ $ git commit
420
420
----
421
421
422
422
Doing so launches your editor of choice.
423
-
(This is set by your shell's `EDITOR` environment variable -- usually vim or emacs, although you can configure it with whatever you want using the `git config --global core.editor` command as you saw in <<_getting_started#_getting_started>>).(((editor, changing default)))(((git commands, config)))
423
+
(This is set by your shell's `EDITOR` environment variable -- usually vim or emacs, although you can configure it with whatever you want using the `git config --global core.editor` command as you saw in <<ch01-getting-started#ch01-getting-started>>).(((editor, changing default)))(((git commands, config)))
424
424
425
425
The editor displays the following text (this example is a Vim screen):
This means we can pull contributions from any of these users pretty easily.
68
68
We may additionally have permission to push to one or more of these, though we can't tell that here.
69
69
70
-
Notice that these remotes use a variety of protocols; we'll cover more about this in <<_git_on_the_server#_getting_git_on_a_server>>.
70
+
Notice that these remotes use a variety of protocols; we'll cover more about this in <<ch04-git-on-the-server#_getting_git_on_a_server>>.
71
71
72
72
==== Adding Remote Repositories
73
73
@@ -103,7 +103,7 @@ From https://github.com/paulboone/ticgit
103
103
----
104
104
105
105
Paul's master branch is now accessible locally as `pb/master` -- you can merge it into one of your branches, or you can check out a local branch at that point if you want to inspect it.
106
-
(We'll go over what branches are and how to use them in much more detail in <<_git_branching#_git_branching>>.)
106
+
(We'll go over what branches are and how to use them in much more detail in <<ch03-git-branching#ch03-git-branching>>.)
107
107
108
108
[[_fetching_and_pulling]]
109
109
==== Fetching and Pulling from Your Remotes
@@ -123,7 +123,7 @@ So, `git fetch origin` fetches any new work that has been pushed to that server
123
123
It's important to note that the `git fetch` command only downloads the data to your local repository -- it doesn't automatically merge it with any of your work or modify what you're currently working on.
124
124
You have to merge it manually into your work when you're ready.
125
125
126
-
If your current branch is set up to track a remote branch (see the next section and <<_git_branching#_git_branching>> for more information), you can use the `git pull` command to automatically fetch and then merge that remote branch into your current branch.(((git commands, pull)))
126
+
If your current branch is set up to track a remote branch (see the next section and <<ch03-git-branching#ch03-git-branching>> for more information), you can use the `git pull` command to automatically fetch and then merge that remote branch into your current branch.(((git commands, pull)))
127
127
This may be an easier or more comfortable workflow for you; and by default, the `git clone` command automatically sets up your local master branch to track the remote master branch (or whatever the default branch is called) on the server you cloned from.
128
128
Running `git pull` generally fetches data from the server you originally cloned from and automatically tries to merge it into the code you're currently working on.
129
129
@@ -142,7 +142,7 @@ $ git push origin master
142
142
This command works only if you cloned from a server to which you have write access and if nobody has pushed in the meantime.
143
143
If you and someone else clone at the same time and they push upstream and then you push upstream, your push will rightly be rejected.
144
144
You'll have to fetch their work first and incorporate it into yours before you'll be allowed to push.
145
-
See <<_git_branching#_git_branching>> for more detailed information on how to push to remote servers.
145
+
See <<ch03-git-branching#ch03-git-branching>> for more detailed information on how to push to remote servers.
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/undoing.asc
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -92,7 +92,7 @@ However, in the scenario described above, the file in your working directory is
92
92
=====
93
93
94
94
For now this magic invocation is all you need to know about the `git reset` command.
95
-
We'll go into much more detail about what `reset` does and how to master it to do really interesting things in <<_git_tools#_git_reset>>.
95
+
We'll go into much more detail about what `reset` does and how to master it to do really interesting things in <<ch07-git-tools#_git_reset>>.
96
96
97
97
==== Unmodifying a Modified File
98
98
@@ -134,8 +134,8 @@ Any changes you made to that file are gone -- Git just copied another file over
134
134
Don't ever use this command unless you absolutely know that you don't want the file.
135
135
=====
136
136
137
-
If you would like to keep the changes you've made to that file but still need to get it out of the way for now, we'll go over stashing and branching in <<_git_branching#_git_branching>>; these are generally better ways to go.
137
+
If you would like to keep the changes you've made to that file but still need to get it out of the way for now, we'll go over stashing and branching in <<ch03-git-branching#ch03-git-branching>>; these are generally better ways to go.
138
138
139
139
Remember, anything that is _committed_ in Git can almost always be recovered.
140
-
Even commits that were on branches that were deleted or commits that were overwritten with an `--amend` commit can be recovered (see <<_git_internals#_data_recovery>> for data recovery).
140
+
Even commits that were on branches that were deleted or commits that were overwritten with an `--amend` commit can be recovered (see <<ch10-git-internals#_data_recovery>> for data recovery).
141
141
However, anything you lose that was never committed is likely never to be seen again.
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/viewing-history.asc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,7 +182,7 @@ a11bef0 - Scott Chacon, 6 years ago : first commit
182
182
You may be wondering what the difference is between _author_ and _committer_.
183
183
The author is the person who originally wrote the work, whereas the committer is the person who last applied the work.
184
184
So, if you send in a patch to a project and one of the core members applies the patch, both of you get credit -- you as the author, and the core member as the committer.
185
-
We'll cover this distinction a bit more in <<_distributed_git#_distributed_git>>.
185
+
We'll cover this distinction a bit more in <<ch05-distributed-git#ch05-distributed-git>>.
186
186
187
187
The `oneline` and `format` options are particularly useful with another `log` option called `--graph`.
188
188
This option adds a nice little ASCII graph showing your branch and merge history:
0 commit comments