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: README.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
@@ -14,9 +14,9 @@ We've also moved to keeping the translations in seperate repositories rather tha
14
14
15
15
To contribute errata or new content to this repository, you will need to open up a Pull Request on GitHub. It is generally a good idea before doing anything major to open an issue and make sure your work will get accepted.
16
16
17
-
You will also need to sign a Contributor License Agreement so if we do a third edition of the book at some point, we won't have to get everyone's permission but instead will simply list you all in an attributions section.
17
+
Errata and basic clarifications will be accepted if we agree that they improve the content. You can also open an issue so we can figure out how or if it needs to be addressed.
18
18
19
-
There is a CLA bot that will ask you to e-sign an agreement if you send a Pull Request to this repository before that pull will be accepted. Sorry about that, one of the issues with having a dual-licensed work.
19
+
Please refrain from making sweeping copy edit changes as they tend to not get accepted and we don't want you wasting your time. These changes tend to be very subjective, often only clarifying things for some small percentage of people and it's rarely worth the time to accept them. Professional copy editors have already reviewed this content multiple times so while you may have somewhat better taste and grammar than we do it's unlikely that your prose is going to be *so* much better that it's worth changing vast swaths of text.
Copy file name to clipboardExpand all lines: book/01-introduction/1-introduction.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
@@ -2,8 +2,8 @@
2
2
== Getting Started
3
3
4
4
This chapter will be about getting started with Git.
5
-
We will begin at the beginning by explaining some background on version control tools, then move on to how to get Git running on your system and finally how to get it setup to start working with.
6
-
At the end of this chapter you should understand why Git is around, why you should use it and you should be all setup to do so.
5
+
We will begin by explaining some background on version control tools, then move on to how to get Git running on your system and finally how to get it set up to start working with.
6
+
At the end of this chapter you should understand why Git is around, why you should use it and you should be all set up to do so.
Copy file name to clipboardExpand all lines: book/01-introduction/sections/first-time-setup.asc
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,9 +46,10 @@ If you want to use a different text editor, such as Emacs, you can do the follow
46
46
$ git config --global core.editor emacs
47
47
----
48
48
49
-
[NOTE]
49
+
[WARNING]
50
50
====
51
-
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.
51
+
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.
52
+
If you don't set an editor like this and you don't know what Vim or Emacs are, you will likely get into a really confusing state when they are launched.
Copy file name to clipboardExpand all lines: book/02-git-basics/sections/recording-changes.asc
+20-9Lines changed: 20 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,14 +214,25 @@ You can also use two asterisks to match nested directories; `a/**/z` would match
214
214
215
215
Here is another example .gitignore file:
216
216
217
-
[source,console]
217
+
[source]
218
218
----
219
-
# a comment - this is ignored
220
-
*.a # no .a files
221
-
!lib.a # but do track lib.a, even though you're ignoring .a files above
222
-
/TODO # only ignore the root TODO file, not subdir/TODO
223
-
build/ # ignore all files in the build/ directory
224
-
doc/*.txt # ignore doc/notes.txt, but not doc/server/arch.txt
219
+
# no .a files
220
+
*.a
221
+
222
+
# but do track lib.a, even though you're ignoring .a files above
223
+
!lib.a
224
+
225
+
# only ignore the root TODO file, not subdir/TODO
226
+
/TODO
227
+
228
+
# ignore all files in the build/ directory
229
+
build/
230
+
231
+
# ignore doc/notes.txt, but not doc/server/arch.txt
232
+
doc/*.txt
233
+
234
+
# ignore all .txt files in the doc/ directory
235
+
doc/**/*.txt
225
236
----
226
237
227
238
[TIP]
@@ -302,7 +313,7 @@ index 0000000..03902a1
302
313
It's important to note that `git diff` by itself doesn't show all changes made since your last commit – only changes that are still unstaged.
303
314
This can be confusing, because if you've staged all of your changes, `git diff` will give you no output.
304
315
305
-
For another example, if you stage the `benchmarks.rb` file and then edit it, you can use `git diff` to see the changes in the file that are staged and the changes that are unstaged:
316
+
For another example, if you stage the `benchmarks.rb` file and then edit it, you can use `git diff` to see the changes in the file that are staged and the changes that are unstaged. If our environment looks like this:
306
317
307
318
[source,console]
308
319
----
@@ -493,7 +504,7 @@ This is a safety feature to prevent accidental removal of data that hasn't yet b
493
504
494
505
Another useful thing you may want to do is to keep the file in your working tree but remove it from your staging area.
495
506
In other words, you may want to keep the file on your hard drive but not have Git track it anymore.
496
-
This is particularly useful if you forgot to add something to your `.gitignore` file and accidentally added it, like a large log file or a bunch of `.a` compiled files.
507
+
This is particularly useful if you forgot to add something to your `.gitignore` file and accidentally staged it, like a large log file or a bunch of `.a` compiled files.
Now, when someone else clones or pulls from your repository, they will get all your tags as well.
211
+
212
+
==== Checking out Tags
213
+
214
+
You can't really check out a tag in Git, since they can't be moved around.
215
+
If you want to put a version of your repository in your working directory that looks like a specific tag, you can create a new branch at a specific tag:
216
+
217
+
[source,console]
218
+
----
219
+
$ git checkout -b version2 v2.0.0
220
+
Switched to a new branch 'version2'
221
+
----
222
+
223
+
Of course if you do this and do a commit, your `version2` branch will be slightly different than your `v2.0.0` tag since it will move forward with your new changes, so do be careful.
Copy file name to clipboardExpand all lines: book/03-git-branching/sections/rebasing.asc
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,12 @@ image::images/basic-rebase-3.png[Rebasing the change introduced in `C3` onto `C4
39
39
40
40
At this point, you can go back to the master branch and do a fast-forward merge.
41
41
42
+
[source,console]
43
+
----
44
+
$ git checkout master
45
+
$ git merge experiment
46
+
----
47
+
42
48
.Fast-forwarding the master branch
43
49
image::images/basic-rebase-4.png[Fast-forwarding the master branch.]
44
50
@@ -171,7 +177,7 @@ Furthermore, if you push this history back up to the server, you'll reintroduce
171
177
It's pretty safe to assume that the other developer doesn't want `C4` and `C6` to be in the history; that's why she rebased in the first place.
172
178
173
179
[[_rebase_rebase]]
174
-
==== Rebase when you Rebase
180
+
==== Rebase When You Rebase
175
181
176
182
If you *do* find yourself in a situation like this, Git has some further magic that might help you out. If someone on your team force pushes changes that overwrite work that you've based work on, your challenge is to figure out what is yours and what they've rewritten.
Copy file name to clipboardExpand all lines: book/03-git-branching/sections/remote-branches.asc
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ Name this remote `teamone`, which will be your shortname for that whole URL.
45
45
image::images/remote-branches-4.png[Adding another server as a remote.]
46
46
47
47
Now, you can run `git fetch teamone` to fetch everything the remote `teamone` server has that you don't have yet.
48
-
Because that server is a subset of the data your `origin` server has right now, Git fetches no data but sets a remote branch called `teamone/master` to point to the commit that `teamone` has as its `master` branch.
48
+
Because that server has a subset of the data your `origin` server has right now, Git fetches no data but sets a remote branch called `teamone/master` to point to the commit that `teamone` has as its `master` branch.
49
49
50
50
.Remote tracking branch for `teamone/master`
51
51
image::images/remote-branches-5.png[Remote tracking branch for `teamone/master`.]
@@ -124,11 +124,9 @@ This gives you a local branch that you can work on that starts where `origin/ser
124
124
(((branches, tracking)))(((branches, upstream)))
125
125
Checking out a local branch from a remote branch automatically creates what is called a ``tracking branch'' (or sometimes an ``upstream branch'').
126
126
Tracking branches are local branches that have a direct relationship to a remote branch.
127
-
If you're on a tracking branch and type `git push`, Git automatically knows which server and branch to push to.
128
-
Also, running `git pull` while on one of these branches fetches all the remote references and then automatically merges in the corresponding remote branch.
127
+
If you're on a tracking branch and type `git pull`, Git automatically knows which server to fetch from and branch to merge into.
129
128
130
129
When you clone a repository, it generally automatically creates a `master` branch that tracks `origin/master`.
131
-
That's why `git push` and `git pull` work out of the box with no other arguments.
132
130
However, you can set up other tracking branches if you wish – ones that track branches on other remotes, or don't track the `master` branch.
133
131
The simple case is the example you just saw, running `git checkout -b [branch] [remotename]/[branch]`.
134
132
This is a common enough operation that git provides the `--track` shorthand:
@@ -149,7 +147,7 @@ Branch sf set up to track remote branch serverfix from origin.
149
147
Switched to a new branch 'sf'
150
148
----
151
149
152
-
Now, your local branch `sf` will automatically push to and pull from `origin/serverfix`.
150
+
Now, your local branch `sf` will automatically pull from `origin/serverfix`.
153
151
154
152
If you already have a local branch and want to set it to a remote branch you just pulled down, or want to change the upstream branch you're tracking, you can use the `-u` or `--set-upstream-to` option to `git branch` to explicitly set it at any time.
0 commit comments