• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Révision153a3d3c04c069d0ef1a2e8f42fcf386710a7f15 (tree)
l'heure2020-10-25 13:21:29
Auteurmatsuand <30614168+matsuand@user...>
Commitermatsuand

Message de Log

日本語訳段落に続いた正規のオリジナル文への対処(===への対処)。20201025結果修正。

Change Summary

Modification

--- a/progit2ja_diff/20201025.result.txt
+++ b/progit2ja_diff/20201025.result.txt
@@ -1,5 +1,5 @@
11 diff -au /tmp/A-git-in-other-environments.asc.tmp ../../git/progit2/progit2/A-git-in-other-environments.asc
2---- /tmp/A-git-in-other-environments.asc.tmp 2020-10-25 11:05:02.074629892 +0900
2+--- /tmp/A-git-in-other-environments.asc.tmp 2020-10-25 13:21:06.560922481 +0900
33 +++ ../../git/progit2/progit2/A-git-in-other-environments.asc 2020-08-29 09:58:24.046195489 +0900
44 @@ -1,4 +1,4 @@
55 -[#A-git-in-other-environments]
@@ -22,7 +22,7 @@ diff -au /tmp/A-git-in-other-environments.asc.tmp ../../git/progit2/progit2/A-gi
2222
2323 Warning: file not found: ../../git/progit2/progit2-ja/B-embedding-git-in-your-applications.asc
2424 diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.asc
25---- /tmp/C-git-commands.asc.tmp 2020-10-25 11:05:02.082630342 +0900
25+--- /tmp/C-git-commands.asc.tmp 2020-10-25 13:21:06.574923226 +0900
2626 +++ ../../git/progit2/progit2/C-git-commands.asc 2020-08-17 16:38:51.074694961 +0900
2727 @@ -1,4 +1,4 @@
2828 -[#C-git-commands]
@@ -30,7 +30,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
3030 [appendix]
3131 == Git Commands
3232
33-@@ -8,10 +8,20 @@
33+@@ -8,6 +8,14 @@
3434 In this appendix, we'll go through all the Git commands we addressed throughout the book, grouped roughly by what they're used for.
3535 We'll talk about what each command very generally does and then point out where in the book you can find us having used it.
3636
@@ -45,29 +45,25 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
4545 === Setup and Config
4646
4747 There are two commands that are used quite a lot, from the first invocations of Git to common every day tweaking and referencing, the `config` and `help` commands.
48-
49-+==== git config
50-+
51- Git has a default way of doing hundreds of things.
52- For a lot of these things, you can tell Git to default to doing them a different way, or set your preferences.
53- This involves everything from telling Git what your name is to specific terminal color preferences or what editor you use.
54-@@ -19,178 +29,251 @@
48+@@ -21,24 +29,62 @@
5549
5650 The `git config` command has been used in nearly every chapter of the book.
5751
5852 -In <<ch01-introduction#r_first_time>> we used it to specify our name, email address and editor preference before we even got started using Git.
53+-
54+-In <<ch02-git-basics#r_git_aliases>> we showed how you could use it to create shorthand commands that expand to long option sequences so you don't have to type them every time.
5955 +In <<ch01-getting-started#_first_time>> we used it to specify our name, email address and editor preference before we even got started using Git.
6056
61--In <<ch02-git-basics#r_git_aliases>> we showed how you could use it to create shorthand commands that expand to long option sequences so you don't have to type them every time.
57+-In <<ch03-git-branching#r_rebasing>> we used it to make `--rebase` the default when you run `git pull`.
6258 +In <<ch02-git-basics-chapter#_git_aliases>> we showed how you could use it to create shorthand commands that expand to long option sequences so you don't have to type them every time.
6359
64--In <<ch03-git-branching#r_rebasing>> we used it to make `--rebase` the default when you run `git pull`.
60+-In <<ch07-git-tools#r_credential_caching>> we used it to set up a default store for your HTTP passwords.
6561 +In <<ch03-git-branching#_rebasing>> we used it to make `--rebase` the default when you run `git pull`.
6662
67--In <<ch07-git-tools#r_credential_caching>> we used it to set up a default store for your HTTP passwords.
63+-In <<ch08-customizing-git#r_keyword_expansion>> we showed how to set up smudge and clean filters on content coming in and out of Git.
6864 +In <<ch07-git-tools#_credential_caching>> we used it to set up a default store for your HTTP passwords.
6965
70--In <<ch08-customizing-git#r_keyword_expansion>> we showed how to set up smudge and clean filters on content coming in and out of Git.
66+-Finally, basically the entirety of <<ch08-customizing-git#r_git_config>> is dedicated to the command.
7167 +In <<ch08-customizing-git#_keyword_expansion>> we showed how to set up smudge and clean filters on content coming in and out of Git.
7268 +
7369 +Finally, basically the entirety of <<ch08-customizing-git#_git_config>> is dedicated to the command.
@@ -109,8 +105,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
109105 +If you have a 32-bit editor on a Windows 64-bit system, the program will be installed in `C:\Program Files (x86)\` rather than `C:\Program Files\` as in the table above.
110106 +====
111107
112--Finally, basically the entirety of <<ch08-customizing-git#r_git_config>> is dedicated to the command.
113-+==== git help
108+ ==== git help
114109
115110 The `git help` command is used to show you all the documentation shipped with Git about any command.
116111 While we're giving a rough overview of most of the more popular ones in this appendix, for a full listing of all of the possible options and flags for every command, you can always run `git help <command>`.
@@ -121,11 +116,8 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
121116
122117 === Getting and Creating Projects
123118
124- There are two ways to get a Git repository.
125- One is to copy it from an existing repository on the network or elsewhere and the other is to create a new one in an existing directory.
119+@@ -49,13 +95,13 @@
126120
127-+==== git init
128-+
129121 To take a directory and turn it into a new Git repository so you can start version controlling it, you can simply run `git init`.
130122
131123 -We first introduce this in <<ch02-git-basics#r_getting_a_repo>>, where we show creating a brand new repository to start working with.
@@ -139,11 +131,10 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
139131
140132 -Finally, we go through some of the details of what it actually does behind the scenes in <<ch10-git-internals#r_plumbing_porcelain>>.
141133 +Finally, we go through some of the details of what it actually does behind the scenes in <<ch10-git-internals#_plumbing_porcelain>>.
142-+
143-+==== git clone
144134
145- The `git clone` command is actually something of a wrapper around several other commands.
146- It creates a new directory, goes into it and runs `git init` to make it an empty Git repository, adds a remote (`git remote add`) to the URL that you pass it (by default named `origin`), runs a `git fetch` from that remote repository and then checks out the latest commit into your working directory with `git checkout`.
135+ ==== git clone
136+
137+@@ -64,16 +110,17 @@
147138
148139 The `git clone` command is used in dozens of places throughout the book, but we'll just list a few interesting places.
149140
@@ -165,12 +156,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
165156 === Basic Snapshotting
166157
167158 For the basic workflow of staging content and committing it to your history, there are only a few basic commands.
168-
169-+==== git add
170-+
171- The `git add` command adds content from the working directory into the staging area (or ``index'') for the next commit.
172- When the `git commit` command is run, by default it only looks at this staging area, so `git add` is used to craft what exactly you would like your next commit snapshot to look like.
173-
159+@@ -86,13 +133,13 @@
174160 This command is an incredibly important command in Git and is mentioned or used dozens of times in this book.
175161 We'll quickly cover some of the unique uses that can be found.
176162
@@ -185,10 +171,10 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
185171
186172 -Finally, we emulate it at a low level in <<ch10-git-internals#r_tree_objects>>, so you can get an idea of what it's doing behind the scenes.
187173 +Finally, we emulate it at a low level in <<ch10-git-internals#_tree_objects>>, so you can get an idea of what it's doing behind the scenes.
188-+
189-+==== git status
190174
191- The `git status` command will show you the different states of files in your working directory and staging area.
175+ ==== git status
176+
177+@@ -100,7 +147,7 @@
192178 Which files are modified and unstaged and which are staged but not yet committed.
193179 In its normal form, it also will show you some basic hints on how to move files between these stages.
194180
@@ -196,34 +182,34 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
196182 +We first cover `status` in <<ch02-git-basics-chapter#_checking_status>>, both in its basic and simplified forms.
197183 While we use it throughout the book, pretty much everything you can do with the `git status` command is covered there.
198184
199-+==== git diff
200-+
185+ ==== git diff
186+@@ -108,36 +155,36 @@
201187 The `git diff` command is used when you want to see differences between any two trees.
202188 This could be the difference between your working environment and your staging area (`git diff` by itself), between your staging area and your last commit (`git diff --staged`), or between two commits (`git diff master branchB`).
203189
204190 -We first look at the basic uses of `git diff` in <<ch02-git-basics#r_git_diff_staged>>, where we show how to see what changes are staged and which are not yet staged.
205191 +We first look at the basic uses of `git diff` in <<ch02-git-basics-chapter#_git_diff_staged>>, where we show how to see what changes are staged and which are not yet staged.
206-+
207-+We use it to look for possible whitespace issues before committing with the `--check` option in <<ch05-distributed-git#_commit_guidelines>>.
208192
209193 -We use it to look for possible whitespace issues before committing with the `--check` option in <<ch05-distributed-git#r_commit_guidelines>>.
210-+We see how to check the differences between branches more effectively with the `git diff A...B` syntax in <<ch05-distributed-git#_what_is_introduced>>.
194++We use it to look for possible whitespace issues before committing with the `--check` option in <<ch05-distributed-git#_commit_guidelines>>.
211195
212196 -We see how to check the differences between branches more effectively with the `git diff A...B` syntax in <<ch05-distributed-git#r_what_is_introduced>>.
213-+We use it to filter out whitespace differences with `-b` and how to compare different stages of conflicted files with `--theirs`, `--ours` and `--base` in <<ch07-git-tools#_advanced_merging>>.
197++We see how to check the differences between branches more effectively with the `git diff A...B` syntax in <<ch05-distributed-git#_what_is_introduced>>.
214198
215199 -We use it to filter out whitespace differences with `-b` and how to compare different stages of conflicted files with `--theirs`, `--ours` and `--base` in <<ch07-git-tools#r_advanced_merging>>.
216-+Finally, we use it to effectively compare submodule changes with `--submodule` in <<ch07-git-tools#_starting_submodules>>.
200++We use it to filter out whitespace differences with `-b` and how to compare different stages of conflicted files with `--theirs`, `--ours` and `--base` in <<ch07-git-tools#_advanced_merging>>.
217201
218202 -Finally, we use it to effectively compare submodule changes with `--submodule` in <<ch07-git-tools#r_starting_submodules>>.
219-+==== git difftool
203++Finally, we use it to effectively compare submodule changes with `--submodule` in <<ch07-git-tools#_starting_submodules>>.
204+
205+ ==== git difftool
220206
221207 The `git difftool` command simply launches an external tool to show you the difference between two trees in case you want to use something other than the built in `git diff` command.
222208
223209 -We only briefly mention this in <<ch02-git-basics#r_git_diff_staged>>.
224210 +We only briefly mention this in <<ch02-git-basics-chapter#_git_diff_staged>>.
225-+
226-+==== git commit
211+
212+ ==== git commit
227213
228214 The `git commit` command takes all the file contents that have been staged with `git add` and records a new permanent snapshot in the database and then moves the branch pointer on the current branch up to it.
229215
@@ -233,32 +219,32 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
233219
234220 -In <<ch02-git-basics#r_undoing>> we cover using the `--amend` option to redo the most recent commit.
235221 +In <<ch02-git-basics-chapter#_undoing>> we cover using the `--amend` option to redo the most recent commit.
236-+
237-+In <<ch03-git-branching#_git_branches_overview>>, we go into much more detail about what `git commit` does and why it does it like that.
238222
239223 -In <<ch03-git-branching#r_git_branches_overview>>, we go into much more detail about what `git commit` does and why it does it like that.
240-+We looked at how to sign commits cryptographically with the `-S` flag in <<ch07-git-tools#_signing_commits>>.
224++In <<ch03-git-branching#_git_branches_overview>>, we go into much more detail about what `git commit` does and why it does it like that.
241225
242226 -We looked at how to sign commits cryptographically with the `-S` flag in <<ch07-git-tools#r_signing_commits>>.
243-+Finally, we take a look at what the `git commit` command does in the background and how it's actually implemented in <<ch10-git-internals#_git_commit_objects>>.
227++We looked at how to sign commits cryptographically with the `-S` flag in <<ch07-git-tools#_signing_commits>>.
244228
245229 -Finally, we take a look at what the `git commit` command does in the background and how it's actually implemented in <<ch10-git-internals#r_git_commit_objects>>.
246-+==== git reset
230++Finally, we take a look at what the `git commit` command does in the background and how it's actually implemented in <<ch10-git-internals#_git_commit_objects>>.
231+
232+ ==== git reset
247233
248- The `git reset` command is primarily used to undo things, as you can possibly tell by the verb.
234+@@ -145,34 +192,34 @@
249235 It moves around the `HEAD` pointer and optionally changes the `index` or staging area and can also optionally change the working directory if you use `--hard`.
250236 This final option makes it possible for this command to lose your work if used incorrectly, so make sure you understand it before using it.
251237
252238 -We first effectively cover the simplest use of `git reset` in <<ch02-git-basics#r_unstaging>>, where we use it to unstage a file we had run `git add` on.
253239 +We first effectively cover the simplest use of `git reset` in <<ch02-git-basics-chapter#_unstaging>>, where we use it to unstage a file we had run `git add` on.
254-+
255-+We then cover it in quite some detail in <<ch07-git-tools#_git_reset>>, which is entirely devoted to explaining this command.
256240
257241 -We then cover it in quite some detail in <<ch07-git-tools#r_git_reset>>, which is entirely devoted to explaining this command.
258-+We use `git reset --hard` to abort a merge in <<ch07-git-tools#_abort_merge>>, where we also use `git merge --abort`, which is a bit of a wrapper for the `git reset` command.
242++We then cover it in quite some detail in <<ch07-git-tools#_git_reset>>, which is entirely devoted to explaining this command.
259243
260244 -We use `git reset --hard` to abort a merge in <<ch07-git-tools#r_abort_merge>>, where we also use `git merge --abort`, which is a bit of a wrapper for the `git reset` command.
261-+==== git rm
245++We use `git reset --hard` to abort a merge in <<ch07-git-tools#_abort_merge>>, where we also use `git merge --abort`, which is a bit of a wrapper for the `git reset` command.
246+
247+ ==== git rm
262248
263249 The `git rm` command is used to remove files from the staging area and working directory for Git.
264250 It is similar to `git add` in that it stages a removal of a file for the next commit.
@@ -270,14 +256,14 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
270256 +The only other differing use of `git rm` in the book is in <<ch10-git-internals#_removing_objects>> where we briefly use and explain the `--ignore-unmatch` when running `git filter-branch`, which simply makes it not error out when the file we are trying to remove doesn't exist.
271257 This can be useful for scripting purposes.
272258
273-+==== git mv
274-+
259+ ==== git mv
260+
275261 The `git mv` command is a thin convenience command to move a file and then run `git add` on the new file and `git rm` on the old file.
276262
277263 -We only briefly mention this command in <<ch02-git-basics#r_git_mv>>.
278264 +We only briefly mention this command in <<ch02-git-basics-chapter#_git_mv>>.
279-+
280-+==== git clean
265+
266+ ==== git clean
281267
282268 The `git clean` command is used to remove unwanted files from your working directory.
283269 This could include removing temporary build artifacts or merge conflict files.
@@ -287,24 +273,20 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
287273
288274 === Branching and Merging
289275
290- There are just a handful of commands that implement most of the branching and merging functionality in Git.
291-
292-+==== git branch
293-+
294- The `git branch` command is actually something of a branch management tool.
276+@@ -184,47 +231,47 @@
295277 It can list the branches you have, create a new branch, delete branches and rename branches.
296278
297279 Most of <<ch03-git-branching#ch03-git-branching>> is dedicated to the `branch` command and it's used throughout the entire chapter.
298280 -We first introduce it in <<ch03-git-branching#r_create_new_branch>> and we go through most of its other features (listing and deleting) in <<ch03-git-branching#r_branch_management>>.
299281 +We first introduce it in <<ch03-git-branching#_create_new_branch>> and we go through most of its other features (listing and deleting) in <<ch03-git-branching#_branch_management>>.
300-+
301-+In <<ch03-git-branching#_tracking_branches>> we use the `git branch -u` option to set up a tracking branch.
302282
303283 -In <<ch03-git-branching#r_tracking_branches>> we use the `git branch -u` option to set up a tracking branch.
304-+Finally, we go through some of what it does in the background in <<ch10-git-internals#_git_refs>>.
284++In <<ch03-git-branching#_tracking_branches>> we use the `git branch -u` option to set up a tracking branch.
305285
306286 -Finally, we go through some of what it does in the background in <<ch10-git-internals#r_git_refs>>.
307-+==== git checkout
287++Finally, we go through some of what it does in the background in <<ch10-git-internals#_git_refs>>.
288+
289+ ==== git checkout
308290
309291 The `git checkout` command is used to switch branches and check content out into your working directory.
310292
@@ -322,8 +304,8 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
322304
323305 -Finally, we go into some implementation detail in <<ch10-git-internals#r_the_head>>.
324306 +Finally, we go into some implementation detail in <<ch10-git-internals#ref_the_ref>>.
325-+
326-+==== git merge
307+
308+ ==== git merge
327309
328310 The `git merge` tool is used to merge one or more branches into the branch you have checked out.
329311 It will then advance the current branch to the result of the merge.
@@ -334,28 +316,26 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
334316
335317 -We covered how to do a squashed merge (where Git merges the work but pretends like it's just a new commit without recording the history of the branch you're merging in) at the very end of <<ch05-distributed-git#r_public_project>>.
336318 +We covered how to do a squashed merge (where Git merges the work but pretends like it's just a new commit without recording the history of the branch you're merging in) at the very end of <<ch05-distributed-git#_public_project>>.
337-+
338-+We went over a lot about the merge process and command, including the `-Xignore-space-change` command and the `--abort` flag to abort a problem merge in <<ch07-git-tools#_advanced_merging>>.
339319
340320 -We went over a lot about the merge process and command, including the `-Xignore-space-change` command and the `--abort` flag to abort a problem merge in <<ch07-git-tools#r_advanced_merging>>.
341-+We learned how to verify signatures before merging if your project is using GPG signing in <<ch07-git-tools#_signing_commits>>.
321++We went over a lot about the merge process and command, including the `-Xignore-space-change` command and the `--abort` flag to abort a problem merge in <<ch07-git-tools#_advanced_merging>>.
342322
343323 -We learned how to verify signatures before merging if your project is using GPG signing in <<ch07-git-tools#r_signing_commits>>.
344-+Finally, we learned about Subtree merging in <<ch07-git-tools#_subtree_merge>>.
324++We learned how to verify signatures before merging if your project is using GPG signing in <<ch07-git-tools#_signing_commits>>.
345325
346326 -Finally, we learned about Subtree merging in <<ch07-git-tools#r_subtree_merge>>.
347-+==== git mergetool
327++Finally, we learned about Subtree merging in <<ch07-git-tools#_subtree_merge>>.
328+
329+ ==== git mergetool
348330
349331 The `git mergetool` command simply launches an external merge helper in case you have issues with a merge in Git.
350332
351333 -We mention it quickly in <<ch03-git-branching#r_basic_merge_conflicts>> and go into detail on how to implement your own external merge tool in <<ch08-customizing-git#r_external_merge_tools>>.
352334 +We mention it quickly in <<ch03-git-branching#_basic_merge_conflicts>> and go into detail on how to implement your own external merge tool in <<ch08-customizing-git#_external_merge_tools>>.
353-+
354-+==== git log
355335
356- The `git log` command is used to show the reachable recorded history of a project from the most recent commit snapshot backwards.
357- By default it will only show the history of the branch you're currently on, but can be given different or even multiple heads or branches from which to traverse.
358-@@ -198,244 +281,305 @@
336+ ==== git log
337+
338+@@ -234,37 +281,38 @@
359339
360340 This command is used in nearly every chapter of the book to demonstrate the history of a project.
361341
@@ -384,15 +364,15 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
384364
385365 -In <<ch07-git-tools#r_signing_commits>> we see how to use `--show-signature` to add a validation string to each commit in the `git log` output based on if it was validly signed or not.
386366 +In <<ch07-git-tools#_signing_commits>> we see how to use `--show-signature` to add a validation string to each commit in the `git log` output based on if it was validly signed or not.
387-+
388-+==== git stash
367+
368+ ==== git stash
389369
390370 The `git stash` command is used to temporarily store uncommitted work in order to clean out your working directory without having to commit unfinished work on a branch.
391371
392372 -This is basically entirely covered in <<ch07-git-tools#r_git_stashing>>.
393373 +This is basically entirely covered in <<ch07-git-tools#_git_stashing>>.
394-+
395-+==== git tag
374+
375+ ==== git tag
396376
397377 The `git tag` command is used to give a permanent bookmark to a specific point in the code history.
398378 Generally this is used for things like releases.
@@ -406,42 +386,39 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
406386
407387 === Sharing and Updating Projects
408388
409- There are not very many commands in Git that access the network, nearly all of the commands operate on the local database.
410- When you are ready to share your work or pull changes from elsewhere, there are a handful of commands that deal with remote repositories.
389+@@ -275,45 +323,45 @@
411390
412-+==== git fetch
413-+
414391 The `git fetch` command communicates with a remote repository and fetches down all the information that is in that repository that is not in your current one and stores it in your local database.
415392
416393 -We first look at this command in <<ch02-git-basics#r_fetching_and_pulling>> and we continue to see examples of it use in <<ch03-git-branching#r_remote_branches>>.
417394 +We first look at this command in <<ch02-git-basics-chapter#_fetching_and_pulling>> and we continue to see examples of its use in <<ch03-git-branching#_remote_branches>>.
418-+
419-+We also use it in several of the examples in <<ch05-distributed-git#_contributing_project>>.
420395
421396 -We also use it in several of the examples in <<ch05-distributed-git#r_contributing_project>>.
422-+We use it to fetch a single specific reference that is outside of the default space in <<ch06-github#_pr_refs>> and we see how to fetch from a bundle in <<ch07-git-tools#_bundling>>.
397++We also use it in several of the examples in <<ch05-distributed-git#_contributing_project>>.
423398
424399 -We use it to fetch a single specific reference that is outside of the default space in <<ch06-github#r_pr_refs>> and we see how to fetch from a bundle in <<ch07-git-tools#r_bundling>>.
425-+We set up highly custom refspecs in order to make `git fetch` do something a little different than the default in <<ch10-git-internals#_refspec>>.
400++We use it to fetch a single specific reference that is outside of the default space in <<ch06-github#_pr_refs>> and we see how to fetch from a bundle in <<ch07-git-tools#_bundling>>.
426401
427402 -We set up highly custom refspecs in order to make `git fetch` do something a little different than the default in <<ch10-git-internals#r_refspec>>.
428-+==== git pull
403++We set up highly custom refspecs in order to make `git fetch` do something a little different than the default in <<ch10-git-internals#_refspec>>.
404+
405+ ==== git pull
429406
430407 The `git pull` command is basically a combination of the `git fetch` and `git merge` commands, where Git will fetch from the remote you specify and then immediately try to merge it into the branch you're on.
431408
432409 -We introduce it quickly in <<ch02-git-basics#r_fetching_and_pulling>> and show how to see what it will merge if you run it in <<ch02-git-basics#r_inspecting_remote>>.
433410 +We introduce it quickly in <<ch02-git-basics-chapter#_fetching_and_pulling>> and show how to see what it will merge if you run it in <<ch02-git-basics-chapter#_inspecting_remote>>.
434-+
435-+We also see how to use it to help with rebasing difficulties in <<ch03-git-branching#_rebase_rebase>>.
436411
437412 -We also see how to use it to help with rebasing difficulties in <<ch03-git-branching#r_rebase_rebase>>.
438-+We show how to use it with a URL to pull in changes in a one-off fashion in <<ch05-distributed-git#_checking_out_remotes>>.
413++We also see how to use it to help with rebasing difficulties in <<ch03-git-branching#_rebase_rebase>>.
439414
440415 -We show how to use it with a URL to pull in changes in a one-off fashion in <<ch05-distributed-git#r_checking_out_remotes>>.
441-+Finally, we very quickly mention that you can use the `--verify-signatures` option to it in order to verify that commits you are pulling have been GPG signed in <<ch07-git-tools#_signing_commits>>.
416++We show how to use it with a URL to pull in changes in a one-off fashion in <<ch05-distributed-git#_checking_out_remotes>>.
442417
443418 -Finally, we very quickly mention that you can use the `--verify-signatures` option to it in order to verify that commits you are pulling have been GPG signed in <<ch07-git-tools#r_signing_commits>>.
444-+==== git push
419++Finally, we very quickly mention that you can use the `--verify-signatures` option to it in order to verify that commits you are pulling have been GPG signed in <<ch07-git-tools#_signing_commits>>.
420+
421+ ==== git push
445422
446423 The `git push` command is used to communicate with another repository, calculate what your local database has that the remote one does not, and then pushes the difference into the other repository.
447424 It requires write access to the other repository and so normally is authenticated somehow.
@@ -470,9 +447,8 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
470447 +Finally, in <<ch10-git-internals#_pushing_refspecs>> we look at pushing with a full refspec instead of the general shortcuts that are normally used.
471448 This can help you be very specific about what work you wish to share.
472449
473-+==== git remote
474-+
475- The `git remote` command is a management tool for your record of remote repositories.
450+ ==== git remote
451+@@ -322,7 +370,7 @@
476452 It allows you to save long URLs as short handles, such as ``origin'' so you don't have to type them out all the time.
477453 You can have several of these and the `git remote` command is used to add, change and delete them.
478454
@@ -481,16 +457,16 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
481457
482458 It is used in nearly every subsequent chapter in the book too, but always in the standard `git remote add <name> <url>` format.
483459
484-+==== git archive
485-+
460+@@ -330,7 +378,7 @@
461+
486462 The `git archive` command is used to create an archive file of a specific snapshot of the project.
487463
488464 -We use `git archive` to create a tarball of a project for sharing in <<ch05-distributed-git#r_preparing_release>>.
489465 +We use `git archive` to create a tarball of a project for sharing in <<ch05-distributed-git#_preparing_release>>.
490-+
491-+==== git submodule
492466
493- The `git submodule` command is used to manage external repositories within a normal repositories.
467+ ==== git submodule
468+
469+@@ -338,7 +386,7 @@
494470 This could be for libraries or other types of shared resources.
495471 The `submodule` command has several sub-commands (`add`, `update`, `sync`, etc) for managing these resources.
496472
@@ -499,8 +475,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
499475
500476 === Inspection and Comparison
501477
502-+==== git show
503-+
478+@@ -347,25 +395,26 @@
504479 The `git show` command can show a Git object in a simple and human readable way.
505480 Normally you would use this to show the information about a tag or a commit.
506481
@@ -512,16 +487,16 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
512487
513488 -One of the more interesting things we do with `git show` is in <<ch07-git-tools#r_manual_remerge>> to extract specific file contents of various stages during a merge conflict.
514489 +One of the more interesting things we do with `git show` is in <<ch07-git-tools#_manual_remerge>> to extract specific file contents of various stages during a merge conflict.
515-+
516-+==== git shortlog
490+
491+ ==== git shortlog
517492
518493 The `git shortlog` command is used to summarize the output of `git log`.
519494 It will take many of the same options that the `git log` command will but instead of listing out all of the commits it will present a summary of the commits grouped by author.
520495
521496 -We showed how to use it to create a nice changelog in <<ch05-distributed-git#r_the_shortlog>>.
522497 +We showed how to use it to create a nice changelog in <<ch05-distributed-git#_the_shortlog>>.
523-+
524-+==== git describe
498+
499+ ==== git describe
525500
526501 The `git describe` command is used to take anything that resolves to a commit and produces a string that is somewhat human-readable and will not change.
527502 It's a way to get a description of a commit that is as unambiguous as a commit SHA-1 but more understandable.
@@ -532,25 +507,22 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
532507
533508 === Debugging
534509
535- Git has a couple of commands that are used to help debug an issue in your code.
536- This ranges from figuring out where something was introduced to figuring out who introduced it.
510+@@ -376,20 +425,20 @@
537511
538-+==== git bisect
539-+
540512 The `git bisect` tool is an incredibly helpful debugging tool used to find which specific commit was the first one to introduce a bug or problem by doing an automatic binary search.
541513
542514 -It is fully covered in <<ch07-git-tools#r_binary_search>> and is only mentioned in that section.
543515 +It is fully covered in <<ch07-git-tools#_binary_search>> and is only mentioned in that section.
544-+
545-+==== git blame
516+
517+ ==== git blame
546518
547519 The `git blame` command annotates the lines of any file with which commit was the last one to introduce a change to each line of the file and what person authored that commit.
548520 This is helpful in order to find the person to ask for more information about a specific section of your code.
549521
550522 -It is covered in <<ch07-git-tools#r_file_annotation>> and is only mentioned in that section.
551523 +It is covered in <<ch07-git-tools#_file_annotation>> and is only mentioned in that section.
552-+
553-+==== git grep
524+
525+ ==== git grep
554526
555527 The `git grep` command can help you find any string or regular expression in any of the files in your source code, even older versions of your project.
556528
@@ -559,35 +531,31 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
559531
560532 === Patching
561533
562- A few commands in Git are centered around the concept of thinking of commits in terms of the changes they introduce, as though the commit series is a series of patches.
563- These commands help you manage your branches in this manner.
564-
565-+==== git cherry-pick
566-+
534+@@ -401,27 +450,27 @@
567535 The `git cherry-pick` command is used to take the change introduced in a single Git commit and try to re-introduce it as a new commit on the branch you're currently on.
568536 This can be useful to only take one or two commits from a branch individually rather than merging in the branch which takes all the changes.
569537
570538 -Cherry picking is described and demonstrated in <<ch05-distributed-git#r_rebase_cherry_pick>>.
571539 +Cherry picking is described and demonstrated in <<ch05-distributed-git#_rebase_cherry_pick>>.
572-+
573-+==== git rebase
540+
541+ ==== git rebase
574542
575543 The `git rebase` command is basically an automated `cherry-pick`.
576544 It determines a series of commits and then cherry-picks them one by one in the same order somewhere else.
577545
578546 -Rebasing is covered in detail in <<ch03-git-branching#r_rebasing>>, including covering the collaborative issues involved with rebasing branches that are already public.
579547 +Rebasing is covered in detail in <<ch03-git-branching#_rebasing>>, including covering the collaborative issues involved with rebasing branches that are already public.
580-+
581-+We use it in practice during an example of splitting your history into two separate repositories in <<ch07-git-tools#_replace>>, using the `--onto` flag as well.
582548
583549 -We use it in practice during an example of splitting your history into two separate repositories in <<ch07-git-tools#r_replace>>, using the `--onto` flag as well.
584-+We go through running into a merge conflict during rebasing in <<ch07-git-tools#ref_rerere>>.
550++We use it in practice during an example of splitting your history into two separate repositories in <<ch07-git-tools#_replace>>, using the `--onto` flag as well.
585551
586552 -We go through running into a merge conflict during rebasing in <<ch07-git-tools#r_rerere>>.
587-+We also use it in an interactive scripting mode with the `-i` option in <<ch07-git-tools#_changing_multiple>>.
553++We go through running into a merge conflict during rebasing in <<ch07-git-tools#ref_rerere>>.
588554
589555 -We also use it in an interactive scripting mode with the `-i` option in <<ch07-git-tools#r_changing_multiple>>.
590-+==== git revert
556++We also use it in an interactive scripting mode with the `-i` option in <<ch07-git-tools#_changing_multiple>>.
557+
558+ ==== git revert
591559
592560 The `git revert` command is essentially a reverse `git cherry-pick`.
593561 It creates a new commit that applies the exact opposite of the change introduced in the commit you're targeting, essentially undoing or reverting it.
@@ -597,18 +565,14 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
597565
598566 === Email
599567
600- Many Git projects, including Git itself, are entirely maintained over mailing lists.
601- Git has a number of tools built into it that help make this process easier, from generating patches you can easily email to applying those patches from an email box.
602-
603-+==== git apply
604-+
568+@@ -433,43 +482,43 @@
605569 The `git apply` command applies a patch created with the `git diff` or even GNU diff command.
606570 It is similar to what the `patch` command might do with a few small differences.
607571
608572 -We demonstrate using it and the circumstances in which you might do so in <<ch05-distributed-git#r_patches_from_email>>.
609573 +We demonstrate using it and the circumstances in which you might do so in <<ch05-distributed-git#_patches_from_email>>.
610-+
611-+==== git am
574+
575+ ==== git am
612576
613577 The `git am` command is used to apply patches from an email inbox, specifically one that is mbox formatted.
614578 This is useful for receiving patches over email and applying them to your project easily.
@@ -621,29 +585,29 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
621585
622586 -We also use it to apply patch formatted GitHub Pull Request changes in <<ch06-github#r_email_notifications>>.
623587 +We also use it to apply patch formatted GitHub Pull Request changes in <<ch06-github#_email_notifications>>.
624-+
625-+==== git format-patch
588+
589+ ==== git format-patch
626590
627591 The `git format-patch` command is used to generate a series of patches in mbox format that you can use to send to a mailing list properly formatted.
628592
629593 -We go through an example of contributing to a project using the `git format-patch` tool in <<ch05-distributed-git#r_project_over_email>>.
630594 +We go through an example of contributing to a project using the `git format-patch` tool in <<ch05-distributed-git#_project_over_email>>.
631-+
632-+==== git imap-send
595+
596+ ==== git imap-send
633597
634598 The `git imap-send` command uploads a mailbox generated with `git format-patch` into an IMAP drafts folder.
635599
636600 -We go through an example of contributing to a project by sending patches with the `git imap-send` tool in <<ch05-distributed-git#r_project_over_email>>.
637601 +We go through an example of contributing to a project by sending patches with the `git imap-send` tool in <<ch05-distributed-git#_project_over_email>>.
638-+
639-+==== git send-email
602+
603+ ==== git send-email
640604
641605 The `git send-email` command is used to send patches that are generated with `git format-patch` over email.
642606
643607 -We go through an example of contributing to a project by sending patches with the `git send-email` tool in <<ch05-distributed-git#r_project_over_email>>.
644608 +We go through an example of contributing to a project by sending patches with the `git send-email` tool in <<ch05-distributed-git#_project_over_email>>.
645-+
646-+==== git request-pull
609+
610+ ==== git request-pull
647611
648612 The `git request-pull` command is simply used to generate an example message body to email to someone.
649613 If you have a branch on a public server and want to let someone know how to integrate those changes without sending the patches over email, you can run this command and send the output to the person you want to pull the changes in.
@@ -653,17 +617,14 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
653617
654618 === External Systems
655619
656- Git comes with a few commands to integrate with other version control systems.
657-
658-+==== git svn
659-+
620+@@ -480,13 +529,13 @@
660621 The `git svn` command is used to communicate with the Subversion version control system as a client.
661622 This means you can use Git to checkout from and commit to a Subversion server.
662623
663624 -This command is covered in depth in <<ch09-git-and-other-scms#r_git_svn>>.
664625 +This command is covered in depth in <<ch09-git-and-other-systems#_git_svn>>.
665-+
666-+==== git fast-import
626+
627+ ==== git fast-import
667628
668629 For other version control systems or importing from nearly any format, you can use `git fast-import` to quickly map the other format to something Git can easily record.
669630
@@ -672,34 +633,31 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
672633
673634 === Administration
674635
675- If you're administering a Git repository or need to fix something in a big way, Git provides a number of administrative commands to help you out.
676-
677-+==== git gc
678-+
636+@@ -497,39 +546,40 @@
679637 The `git gc` command runs ``garbage collection'' on your repository, removing unnecessary files in your database and packing up the remaining files into a more efficient format.
680638
681639 This command normally runs in the background for you, though you can manually run it if you wish.
682640 -We go over some examples of this in <<ch10-git-internals#r_git_gc>>.
683641 +We go over some examples of this in <<ch10-git-internals#_git_gc>>.
684-+
685-+==== git fsck
642+
643+ ==== git fsck
686644
687645 The `git fsck` command is used to check the internal database for problems or inconsistencies.
688646
689647 -We only quickly use this once in <<ch10-git-internals#r_data_recovery>> to search for dangling objects.
690648 +We only quickly use this once in <<ch10-git-internals#_data_recovery>> to search for dangling objects.
691-+
692-+==== git reflog
649+
650+ ==== git reflog
693651
694652 The `git reflog` command goes through a log of where all the heads of your branches have been as you work to find commits you may have lost through rewriting histories.
695653
696654 -We cover this command mainly in <<ch07-git-tools#r_git_reflog>>, where we show normal usage to and how to use `git log -g` to view the same information with `git log` output.
697655 +We cover this command mainly in <<ch07-git-tools#_git_reflog>>, where we show normal usage to and how to use `git log -g` to view the same information with `git log` output.
698-+
699-+We also go through a practical example of recovering such a lost branch in <<ch10-git-internals#_data_recovery>>.
700656
701657 -We also go through a practical example of recovering such a lost branch in <<ch10-git-internals#r_data_recovery>>.
702-+==== git filter-branch
658++We also go through a practical example of recovering such a lost branch in <<ch10-git-internals#_data_recovery>>.
659+
660+ ==== git filter-branch
703661
704662 The `git filter-branch` command is used to rewrite loads of commits according to certain patterns, like removing a file everywhere or filtering the entire repository down to a single subdirectory for extracting a project.
705663
@@ -726,13 +684,13 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as
726684 However, most of the low level plumbing commands we cover are in <<ch10-git-internals#ch10-git-internals>>, which is more or less what the chapter is focused on.
727685 We tried to avoid use of them throughout most of the rest of the book.
728686 diff -au /tmp/LICENSE.asc.tmp ../../git/progit2/progit2/LICENSE.asc
729---- /tmp/LICENSE.asc.tmp 2020-10-25 11:05:02.088630679 +0900
687+--- /tmp/LICENSE.asc.tmp 2020-10-25 13:21:06.580923545 +0900
730688 +++ ../../git/progit2/progit2/LICENSE.asc 2020-06-28 16:44:50.900011670 +0900
731689 @@ -0,0 +1,2 @@
732690 +This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
733691 +To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/3.0 or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
734692 diff -au /tmp/README.asc.tmp ../../git/progit2/progit2/README.asc
735---- /tmp/README.asc.tmp 2020-10-25 11:05:02.092630904 +0900
693+--- /tmp/README.asc.tmp 2020-10-25 13:21:06.590924077 +0900
736694 +++ ../../git/progit2/progit2/README.asc 2020-09-07 09:33:11.246683703 +0900
737695 @@ -1,51 +1,22 @@
738696 -= Pro Git 第2版 日本語翻訳
@@ -818,7 +776,7 @@ diff -au /tmp/README.asc.tmp ../../git/progit2/progit2/README.asc
818776 -If you'd like to help out by making a change or contributing a translation, take a look at the link:CONTRIBUTING.md[contributor's guide].
819777 +If you'd like to help out by making a change, take a look at the link:CONTRIBUTING.md[contributor's guide].
820778 diff -au /tmp/TRANSLATION_NOTES.asc.tmp ../../git/progit2/progit2/TRANSLATION_NOTES.asc
821---- /tmp/TRANSLATION_NOTES.asc.tmp 2020-10-25 11:05:02.097631185 +0900
779+--- /tmp/TRANSLATION_NOTES.asc.tmp 2020-10-25 13:21:06.598924502 +0900
822780 +++ ../../git/progit2/progit2/TRANSLATION_NOTES.asc 2020-06-28 16:44:50.919014468 +0900
823781 @@ -0,0 +1,11 @@
824782 +== Translation Notes
@@ -833,7 +791,7 @@ diff -au /tmp/TRANSLATION_NOTES.asc.tmp ../../git/progit2/progit2/TRANSLATION_NO
833791 +As the work is translated, please update the `status.json` file to indicate the rough percentage complete each file is.
834792 +This will be shown on various pages to let people know how much work is left to be done.
835793 diff -au /tmp/book/01-introduction/sections/about-version-control.asc.tmp ../../git/progit2/progit2/book/01-introduction/sections/about-version-control.asc
836---- /tmp/book/01-introduction/sections/about-version-control.asc.tmp 2020-10-25 11:05:02.101631410 +0900
794+--- /tmp/book/01-introduction/sections/about-version-control.asc.tmp 2020-10-25 13:21:06.605924875 +0900
837795 +++ ../../git/progit2/progit2/book/01-introduction/sections/about-version-control.asc 2020-07-04 16:36:46.718685392 +0900
838796 @@ -1,57 +1,60 @@
839797 === About Version Control
@@ -912,7 +870,7 @@ diff -au /tmp/book/01-introduction/sections/about-version-control.asc.tmp ../../
912870
913871 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.
914872 diff -au /tmp/book/01-introduction/sections/command-line.asc.tmp ../../git/progit2/progit2/book/01-introduction/sections/command-line.asc
915---- /tmp/book/01-introduction/sections/command-line.asc.tmp 2020-10-25 11:05:02.106631691 +0900
873+--- /tmp/book/01-introduction/sections/command-line.asc.tmp 2020-10-25 13:21:06.612925247 +0900
916874 +++ ../../git/progit2/progit2/book/01-introduction/sections/command-line.asc 2020-06-28 16:44:50.920014615 +0900
917875 @@ -1,11 +1,11 @@
918876 === The Command Line
@@ -931,7 +889,7 @@ diff -au /tmp/book/01-introduction/sections/command-line.asc.tmp ../../git/progi
931889 +So we will expect you to know how to open Terminal in macOS or Command Prompt or PowerShell in Windows.
932890 If you don't know what we're talking about here, you may need to stop and research that quickly so that you can follow the rest of the examples and descriptions in this book.
933891 diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/progit2/progit2/book/01-introduction/sections/first-time-setup.asc
934---- /tmp/book/01-introduction/sections/first-time-setup.asc.tmp 2020-10-25 11:05:02.111631973 +0900
892+--- /tmp/book/01-introduction/sections/first-time-setup.asc.tmp 2020-10-25 13:21:06.619925619 +0900
935893 +++ ../../git/progit2/progit2/book/01-introduction/sections/first-time-setup.asc 2020-08-10 10:02:15.168231103 +0900
936894 @@ -1,4 +1,4 @@
937895 -[[r_first_time]]
@@ -939,7 +897,7 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p
939897 === First-Time Git Setup
940898
941899 Now that you have Git on your system, you'll want to do a few things to customize your Git environment.
942-@@ -8,58 +8,129 @@
900+@@ -8,64 +8,129 @@
943901 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)))
944902 These variables can be stored in three different places:
945903
@@ -995,25 +953,27 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p
995953
996954 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.
997955 If not configured, Git uses your system's default editor.
998--If you want to use a different text editor, such as Emacs, you can do the following:
956++
957+ If you want to use a different text editor, such as Emacs, you can do the following:
999958
1000959 -While on a Windows system, if you want to use a different text editor, such as Notepad++, you can do the following:
1001--
1002--On a x86 system
1003-+If you want to use a different text editor, such as Emacs, you can do the following:
1004-
1005--On a x64 system
1006960 +[source,console]
1007961 +----
1008962 +$ git config --global core.editor emacs
1009963 +----
1010-+
964+
965+-On a x86 system
1011966 +On a Windows system, if you want to use a different text editor, you must specify the full path to its executable file.
1012967 +This can be different depending on how your editor is packaged.
1013-+
968+
969+-On a x64 system
1014970 +In the case of Notepad++, a popular programming editor, you are likely to want to use the 32-bit version, since at the time of writing the 64-bit version doesn't support all plug-ins.
1015971 +If you are on a 32-bit Windows system, or you have a 64-bit editor on a 64-bit system, you'll type something like this:
1016-+
972+
973+-====
974+-Vim, Emacs and Notepad++ are popular text editors often used by developers on Unix based systems like Linux and OS X or a Windows system.
975+-If you are not familiar with either of these editors, you may need to search for specific instructions for how to set up your favorite editor with Git.
976+-====
1017977 +[source,console]
1018978 +----
1019979 +$ git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"
@@ -1021,8 +981,6 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p
1021981
1022982 +[NOTE]
1023983 ====
1024--Vim, Emacs and Notepad++ are popular text editors often used by developers on Unix based systems like Linux and OS X or a Windows system.
1025--If you are not familiar with either of these editors, you may need to search for specific instructions for how to set up your favorite editor with Git.
1026984 +Vim, Emacs and Notepad++ are popular text editors often used by developers on Unix-based systems like Linux and macOS or a Windows system.
1027985 +If you are using another editor, or a 32-bit version, please find specific instructions for how to set up your favorite editor with Git in <<C-git-commands#_core_editor>>.
1028986 ====
@@ -1035,6 +993,8 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p
1035993 +An example on a Windows system may include a prematurely terminated Git operation during a Git initiated edit.
1036994 ====
1037995
996+-====
997+-====
1038998 +==== Your default branch name
1039999 +
10401000 +By default Git will create a branch called _master_ when you create a new repository with `git init`.
@@ -1046,7 +1006,7 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p
10461006 +----
10471007 +$ git config --global init.defaultBranch main
10481008 +----
1049-+
1009+
10501010 ==== Checking Your Settings
10511011
10521012 -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:
@@ -1088,7 +1048,7 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p
10881048 +----
10891049 +====
10901050 diff -au /tmp/book/01-introduction/sections/help.asc.tmp ../../git/progit2/progit2/book/01-introduction/sections/help.asc
1091---- /tmp/book/01-introduction/sections/help.asc.tmp 2020-10-25 11:05:02.116632254 +0900
1051+--- /tmp/book/01-introduction/sections/help.asc.tmp 2020-10-25 13:21:06.625925939 +0900
10921052 +++ ../../git/progit2/progit2/book/01-introduction/sections/help.asc 2020-07-04 16:36:46.718685392 +0900
10931053 @@ -1,10 +1,48 @@
10941054 -[[r_git_help]]
@@ -1144,7 +1104,7 @@ diff -au /tmp/book/01-introduction/sections/help.asc.tmp ../../git/progit2/progi
11441104 +----
11451105 +
11461106 diff -au /tmp/book/01-introduction/sections/history.asc.tmp ../../git/progit2/progit2/book/01-introduction/sections/history.asc
1147---- /tmp/book/01-introduction/sections/history.asc.tmp 2020-10-25 11:05:02.120632479 +0900
1107+--- /tmp/book/01-introduction/sections/history.asc.tmp 2020-10-25 13:21:06.632926311 +0900
11481108 +++ ../../git/progit2/progit2/book/01-introduction/sections/history.asc 2020-06-28 16:44:50.921014763 +0900
11491109 @@ -17,4 +17,4 @@
11501110 * Able to handle large projects like the Linux kernel efficiently (speed and data size)
@@ -1153,9 +1113,9 @@ diff -au /tmp/book/01-introduction/sections/history.asc.tmp ../../git/progit2/pr
11531113 -It's incredibly 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>>).
11541114 +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>>).
11551115 diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2/progit2/book/01-introduction/sections/installing.asc
1156---- /tmp/book/01-introduction/sections/installing.asc.tmp 2020-10-25 11:05:02.125632760 +0900
1116+--- /tmp/book/01-introduction/sections/installing.asc.tmp 2020-10-25 13:21:06.638926630 +0900
11571117 +++ ../../git/progit2/progit2/book/01-introduction/sections/installing.asc 2020-07-04 16:36:46.718685392 +0900
1158-@@ -4,69 +4,144 @@
1118+@@ -4,72 +4,144 @@
11591119 Even if it's already installed, it's probably a good idea to update to the latest version.
11601120 You can either install it as a package or via another installer, or download the source code and compile it yourself.
11611121
@@ -1165,6 +1125,9 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2
11651125 +This book was written using Git version *2.8.0*.
11661126 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.
11671127 -Since Git is quite excellent at preserving backwards compatibility, any version after 2.0 should work just fine.
1128+-====
1129+-
1130+-====
11681131 +Since Git is quite excellent at preserving backwards compatibility, any version after 2.8 should work just fine.
11691132 ====
11701133
@@ -1175,24 +1138,24 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2
11751138 +(((Linux, installing)))
11761139 +If you want to install the basic Git tools on Linux via a binary installer, you can generally do so through the package management tool that comes with your distribution.
11771140 +If you're on Fedora (or any closely-related RPM-based distribution, such as RHEL or CentOS), you can use `dnf`:
1178-
1179--If you're on a Debian-based distribution like Ubuntu, try apt-get:
1141++
11801142 +[source,console]
11811143 +----
11821144 +$ sudo dnf install git-all
11831145 +----
11841146
1185--For more options, there are instructions for installing on several different Unix flavors on the Git website, at http://git-scm.com/download/linux[].
1147+-If you're on a Debian-based distribution like Ubuntu, try apt-get:
11861148 +If you're on a Debian-based distribution, such as Ubuntu, try `apt`:
11871149
1188--==== Installing on Mac
1150+-For more options, there are instructions for installing on several different Unix flavors on the Git website, at http://git-scm.com/download/linux[].
11891151 +[source,console]
11901152 +----
11911153 +$ sudo apt install git-all
11921154 +----
11931155
1156+-==== Installing on Mac
11941157 +For more options, there are instructions for installing on several different Unix distributions on the Git website, at https://git-scm.com/download/linux[].
1195-+
1158+
11961159 +==== Installing on macOS
11971160 +
11981161 +(((macOS, installing)))
@@ -1231,11 +1194,11 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2
12311194 -Note that this is a project called Git for Windows, which is separate from Git itself; for more information on it, go to https://git-for-windows.github.io/[].
12321195 +Just go to https://git-scm.com/download/win[] and the download will start automatically.
12331196 +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[].
1234-+
1235-+To get an automated installation you can use the https://chocolatey.org/packages/git[Git Chocolatey package].
1236-+Note that the Chocolatey package is community maintained.
12371197
12381198 -Another easy way to get Git installed is by installing GitHub for Windows.
1199++To get an automated installation you can use the https://chocolatey.org/packages/git[Git Chocolatey package].
1200++Note that the Chocolatey package is community maintained.
1201++
12391202 +Another easy way to get Git installed is by installing GitHub Desktop.
12401203 The installer includes a command line version of Git as well as the GUI.
12411204 -It also works well with Powershell, and sets up solid credential caching and sane CRLF settings.(((Powershell)))(((CRLF)))(((credential caching)))
@@ -1253,8 +1216,7 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2
12531216 -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 the minimal dependencies for compiling and installing the Git binaries:
12541217 +If you do want to install Git from source, you need to have the following libraries that Git depends on: autotools, curl, zlib, openssl, expat, and libiconv.
12551218 +For example, if you're on a system that has `dnf` (such as Fedora) or `apt-get` (such as a Debian-based system), you can use one of these commands to install the minimal dependencies for compiling and installing the Git binaries:
1256-
1257--In order to be able to add the documentation in various formats (doc, html, info), these additional dependencies are required (Note: 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):
1219++
12581220 +[source,console]
12591221 +----
12601222 +$ sudo dnf install dh-autoreconf curl-devel expat-devel gettext-devel \
@@ -1271,12 +1233,13 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2
12711233 +$ sudo apt-get install asciidoc xmlto docbook2x
12721234 +----
12731235
1274--Additionally, if you're using Fedora/RHEL/RHEL-derivatives, you need to do this
1236+-In order to be able to add the documentation in various formats (doc, html, info), these additional dependencies are required (Note: 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):
12751237 +[NOTE]
12761238 +====
12771239 +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.
12781240 +====
1279-+
1241+
1242+-Additionally, if you're using Fedora/RHEL/RHEL-derivatives, you need to do this
12801243 +If you're using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the `install-info` package:
12811244 +
12821245 +[source,console]
@@ -1325,7 +1288,7 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2
13251288 +----
13261289 Warning: file not found: ../../git/progit2/progit2-ja/book/01-introduction/sections/what-is-git.asc
13271290 diff -au /tmp/book/02-git-basics/sections/aliases.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/aliases.asc
1328---- /tmp/book/02-git-basics/sections/aliases.asc.tmp 2020-10-25 11:05:02.148634054 +0900
1291+--- /tmp/book/02-git-basics/sections/aliases.asc.tmp 2020-10-25 13:21:06.645927003 +0900
13291292 +++ ../../git/progit2/progit2/book/02-git-basics/sections/aliases.asc 2020-07-03 19:43:27.508489967 +0900
13301293 @@ -1,28 +1,70 @@
13311294 -[[r_git_aliases]]
@@ -1402,7 +1365,7 @@ diff -au /tmp/book/02-git-basics/sections/aliases.asc.tmp ../../git/progit2/prog
14021365 +$ git config --global alias.visual '!gitk'
14031366 +----
14041367 diff -au /tmp/book/02-git-basics/sections/getting-a-repository.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/getting-a-repository.asc
1405---- /tmp/book/02-git-basics/sections/getting-a-repository.asc.tmp 2020-10-25 11:05:02.153634335 +0900
1368+--- /tmp/book/02-git-basics/sections/getting-a-repository.asc.tmp 2020-10-25 13:21:06.652927375 +0900
14061369 +++ ../../git/progit2/progit2/book/02-git-basics/sections/getting-a-repository.asc 2020-07-01 10:48:37.610009640 +0900
14071370 @@ -1,41 +1,87 @@
14081371 -[[r_getting_a_repo]]
@@ -1509,7 +1472,7 @@ diff -au /tmp/book/02-git-basics/sections/getting-a-repository.asc.tmp ../../git
15091472 -<<ch04-git-server#r_git_on_the_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.
15101473 +<<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.
15111474 diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/recording-changes.asc
1512---- /tmp/book/02-git-basics/sections/recording-changes.asc.tmp 2020-10-25 11:05:02.160634728 +0900
1475+--- /tmp/book/02-git-basics/sections/recording-changes.asc.tmp 2020-10-25 13:21:06.661927854 +0900
15131476 +++ ../../git/progit2/progit2/book/02-git-basics/sections/recording-changes.asc 2020-07-04 16:36:46.720685416 +0900
15141477 @@ -1,48 +1,91 @@
15151478 === Recording Changes to the Repository
@@ -1737,7 +1700,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr
17371700 ==== Ignoring Files
17381701
17391702 Often, you'll have a class of files that you don't want Git to automatically add or even show you as being untracked.
1740-@@ -86,57 +205,198 @@
1703+@@ -86,60 +205,198 @@
17411704 In such cases, you can create a file listing patterns to match them named `.gitignore`.(((ignoring files)))
17421705 Here is an example `.gitignore` file:
17431706
@@ -1800,15 +1763,15 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr
18001763 ====
18011764
18021765 +[NOTE]
1803-+====
1766+ ====
18041767 +In the simple case, a repository might have a single `.gitignore` file in its root directory, which applies recursively to the entire repository.
18051768 +However, it is also possible to have additional `.gitignore` files in subdirectories.
18061769 +The rules in these nested `.gitignore` files apply only to the files under the directory where they are located.
18071770 +The Linux kernel source repository has 206 `.gitignore` files.
18081771 +
18091772 +It is beyond the scope of this book to get into the details of multiple `.gitignore` files; see `man gitignore` for the details.
1810-+====
1811-+
1773+ ====
1774+
18121775 +[[_git_diff_staged]]
18131776 ==== Viewing Your Staged and Unstaged Changes
18141777
@@ -1946,10 +1909,13 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr
19461909 .Git Diff in an External Tool
19471910 ====
19481911 We will continue to use the `git diff` command in various ways throughout the rest of the book.
1949-@@ -145,27 +405,68 @@
1912+@@ -148,30 +405,68 @@
19501913 Run `git difftool --tool-help` to see what is available on your system.
19511914 ====
19521915
1916+-====
1917+-====
1918+-
19531919 +[[_committing_changes]]
19541920 ==== Committing Your Changes
19551921
@@ -2019,7 +1985,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr
20191985 Now you've created your first commit!
20201986 You can see that the commit has given you some output about itself: which branch you committed to (`master`), what SHA-1 checksum the commit has (`463dc4f`), how many files were changed, and statistics about lines added and removed in the commit.
20211987
2022-@@ -175,25 +476,73 @@
1988+@@ -181,25 +476,73 @@
20231989
20241990 ==== Skipping the Staging Area
20251991
@@ -2095,7 +2061,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr
20952061 This is a safety feature to prevent accidental removal of data that hasn't yet been recorded in a snapshot and that can't be recovered from Git.
20962062
20972063 Another useful thing you may want to do is to keep the file in your working tree but remove it from your staging area.
2098-@@ -201,30 +550,71 @@
2064+@@ -207,30 +550,71 @@
20992065 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.
21002066 To do this, use the `--cached` option:
21012067
@@ -2171,7 +2137,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr
21712137 +The only real difference is that `git mv` is one command instead of three -- it's a convenience function.
21722138 More importantly, you can use any tool you like to rename a file, and address the add/rm later, before you commit.
21732139 diff -au /tmp/book/02-git-basics/sections/remotes.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/remotes.asc
2174---- /tmp/book/02-git-basics/sections/remotes.asc.tmp 2020-10-25 11:05:02.167635122 +0900
2140+--- /tmp/book/02-git-basics/sections/remotes.asc.tmp 2020-10-25 13:21:06.672928439 +0900
21752141 +++ ../../git/progit2/progit2/book/02-git-basics/sections/remotes.asc 2020-07-17 09:06:42.261936072 +0900
21762142 @@ -1,4 +1,4 @@
21772143 -[[r_remote_repos]]
@@ -2432,7 +2398,7 @@ diff -au /tmp/book/02-git-basics/sections/remotes.asc.tmp ../../git/progit2/prog
24322398 +
24332399 +Once you delete the reference to a remote this way, all remote-tracking branches and configuration settings associated with that remote are also deleted.
24342400 diff -au /tmp/book/02-git-basics/sections/tagging.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/tagging.asc
2435---- /tmp/book/02-git-basics/sections/tagging.asc.tmp 2020-10-25 11:05:02.173635460 +0900
2401+--- /tmp/book/02-git-basics/sections/tagging.asc.tmp 2020-10-25 13:21:06.680928864 +0900
24362402 +++ ../../git/progit2/progit2/book/02-git-basics/sections/tagging.asc 2020-08-29 09:58:24.048195629 +0900
24372403 @@ -1,77 +1,299 @@
24382404 -[[r_git_tagging]]
@@ -2753,7 +2719,7 @@ diff -au /tmp/book/02-git-basics/sections/tagging.asc.tmp ../../git/progit2/prog
27532719 -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.
27542720 +If you do this and make 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.
27552721 diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/undoing.asc
2756---- /tmp/book/02-git-basics/sections/undoing.asc.tmp 2020-10-25 11:05:02.179635797 +0900
2722+--- /tmp/book/02-git-basics/sections/undoing.asc.tmp 2020-10-25 13:21:06.690929396 +0900
27572723 +++ ../../git/progit2/progit2/book/02-git-basics/sections/undoing.asc 2020-10-18 09:42:35.779991668 +0900
27582724 @@ -1,4 +1,4 @@
27592725 -[[r_undoing]]
@@ -2775,7 +2741,7 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog
27752741
27762742 This command takes your staging area and uses it for the commit.
27772743 If you've made no changes since your last commit (for instance, you run this command immediately after your previous commit), then your snapshot will look exactly the same, and all you'll change is your commit message.
2778-@@ -17,50 +22,214 @@
2744+@@ -17,56 +22,214 @@
27792745
27802746 As an example, if you commit and then realize you forgot to stage the changes in a file you wanted to add to this commit, you can do something like this:
27812747
@@ -2855,6 +2821,9 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog
28552821 =====
28562822 -While `git reset` _can_ be a dangerous command if you call it with `--hard`, in this instance the file in your working directory is not touched.
28572823 -Calling `git reset` without an option is not dangerous - it only touches your staging area.
2824+-=====
2825+-
2826+-=====
28582827 +It's true that `git reset` can be a dangerous command, especially if you provide the `--hard` flag.
28592828 +However, in the scenario described above, the file in your working directory is not touched, so it's relatively safe.
28602829 =====
@@ -2902,6 +2871,9 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog
29022871 It's important to understand that `git checkout -- <file>` is a dangerous command.
29032872 -Any changes you made to that file are gone – you just copied another file over it.
29042873 -Don't ever use this command unless you absolutely know that you don't want the file.
2874+-=====
2875+-
2876+-=====
29052877 +Any local changes you made to that file are gone -- Git just replaced that file with the most recently-committed version.
29062878 +Don't ever use this command unless you absolutely know that you don't want those unsaved local changes.
29072879 =====
@@ -3000,7 +2972,7 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog
30002972 +Don't ever use this command unless you absolutely know that you don't want those unsaved local changes.
30012973 +=====
30022974 diff -au /tmp/book/02-git-basics/sections/viewing-history.asc.tmp ../../git/progit2/progit2/book/02-git-basics/sections/viewing-history.asc
3003---- /tmp/book/02-git-basics/sections/viewing-history.asc.tmp 2020-10-25 11:05:02.185636135 +0900
2975+--- /tmp/book/02-git-basics/sections/viewing-history.asc.tmp 2020-10-25 13:21:06.699929875 +0900
30042976 +++ ../../git/progit2/progit2/book/02-git-basics/sections/viewing-history.asc 2020-09-26 08:56:07.950296410 +0900
30052977 @@ -1,76 +1,213 @@
30062978 -[[r_viewing_history]]
@@ -3350,7 +3322,7 @@ diff -au /tmp/book/02-git-basics/sections/viewing-history.asc.tmp ../../git/prog
33503322 +To prevent the display of merge commits cluttering up your log history, simply add the log option `--no-merges`.
33513323 +====
33523324 diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp ../../git/progit2/progit2/book/03-git-branching/sections/basic-branching-and-merging.asc
3353---- /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp 2020-10-25 11:05:02.191636472 +0900
3325+--- /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp 2020-10-25 13:21:06.707930301 +0900
33543326 +++ ../../git/progit2/progit2/book/03-git-branching/sections/basic-branching-and-merging.asc 2020-07-04 16:36:46.720685416 +0900
33553327 @@ -3,8 +3,8 @@
33563328 Let's go through a simple example of branching and merging with a workflow that you might use in the real world.
@@ -3363,7 +3335,7 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp
33633335 . Do some work in that branch.
33643336
33653337 At this stage, you'll receive a call that another issue is critical and you need a hotfix.
3366-@@ -13,134 +13,306 @@
3338+@@ -13,138 +13,306 @@
33673339 . Switch to your production branch.
33683340 . Create a branch to add the hotfix.
33693341 . After it's tested, merge the hotfix branch, and push to production.
@@ -3414,11 +3386,11 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp
34143386 +$ vim index.html
34153387 +$ git commit -a -m 'Create new footer [issue 53]'
34163388 +----
3417-+
3418-+.The `iss53` branch has moved forward with your work
3419-+image::images/basic-branching-3.png[The `iss53` branch has moved forward with your work]
34203389
34213390 -Now you get the call that there is an issue with the web site, and you need to fix it immediately.
3391++.The `iss53` branch has moved forward with your work
3392++image::images/basic-branching-3.png[The `iss53` branch has moved forward with your work]
3393++
34223394 +Now you get the call that there is an issue with the website, and you need to fix it immediately.
34233395 With Git, you don't have to deploy your fix along with the `iss53` changes you've made, and you don't have to put a lot of effort into reverting those changes before you can work on applying your fix to what is in production.
34243396 All you have to do is switch back to your `master` branch.
@@ -3553,12 +3525,12 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp
35533525 Now that your work is merged in, you have no further need for the `iss53` branch.
35543526 -You can close the ticket in your ticket-tracking system, and delete the branch:
35553527 +You can close the issue in your issue-tracking system, and delete the branch:
3556-+
3528+
35573529 +[source,console]
35583530 +----
35593531 +$ git branch -d iss53
35603532 +----
3561-
3533++
35623534 +[[_basic_merge_conflicts]]
35633535 ==== Basic Merge Conflicts
35643536
@@ -3604,7 +3576,7 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp
36043576 +----
36053577 +<<<<<<< HEAD:index.html
36063578 +<div id="footer">contact : email.support@github.com</div>
3607-+=======
3579+ =======
36083580 +<div id="footer">
36093581 + please contact us at support@github.com
36103582 +</div>
@@ -3652,6 +3624,9 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp
36523624 +[NOTE]
36533625 ====
36543626 -If you need more advanced tools for resolving tricky merge conflicts, we cover more on merging in <<ch07-git-tools#r_advanced_merging>>.
3627+-====
3628+-
3629+-====
36553630 +If you need more advanced tools for resolving tricky merge conflicts, we cover more on merging in <<ch07-git-tools#_advanced_merging>>.
36563631 ====
36573632
@@ -3700,7 +3675,7 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp
37003675 +
37013676 +If you think it would be helpful to others looking at this merge in the future, you can modify this commit message with details about how you resolved the merge and explain why you did the changes you made if these are not obvious.
37023677 diff -au /tmp/book/03-git-branching/sections/branch-management.asc.tmp ../../git/progit2/progit2/book/03-git-branching/sections/branch-management.asc
3703---- /tmp/book/03-git-branching/sections/branch-management.asc.tmp 2020-10-25 11:05:02.196636753 +0900
3678+--- /tmp/book/03-git-branching/sections/branch-management.asc.tmp 2020-10-25 13:21:06.716930779 +0900
37043679 +++ ../../git/progit2/progit2/book/03-git-branching/sections/branch-management.asc 2020-09-12 09:27:13.221663700 +0900
37053680 @@ -1,4 +1,4 @@
37063681 -[[r_branch_management]]
@@ -3848,9 +3823,9 @@ diff -au /tmp/book/03-git-branching/sections/branch-management.asc.tmp ../../git
38483823 +$ git push origin --delete master
38493824 +----
38503825 diff -au /tmp/book/03-git-branching/sections/nutshell.asc.tmp ../../git/progit2/progit2/book/03-git-branching/sections/nutshell.asc
3851---- /tmp/book/03-git-branching/sections/nutshell.asc.tmp 2020-10-25 11:05:02.202637091 +0900
3826+--- /tmp/book/03-git-branching/sections/nutshell.asc.tmp 2020-10-25 13:21:06.725931258 +0900
38523827 +++ ../../git/progit2/progit2/book/03-git-branching/sections/nutshell.asc 2020-09-26 08:56:07.950296410 +0900
3853-@@ -1,34 +1,41 @@
3828+@@ -1,100 +1,150 @@
38543829 -[[r_git_branches_overview]]
38553830 +[[_git_branches_overview]]
38563831 === Branches in a Nutshell
@@ -3901,9 +3876,12 @@ diff -au /tmp/book/03-git-branching/sections/nutshell.asc.tmp ../../git/progit2/
39013876 ====
39023877 The ``master'' branch in Git is not a special branch.(((master)))
39033878 It is exactly like any other branch.
3904-@@ -36,62 +43,108 @@
3879+ The only reason nearly every repository has one is that the `git init` command creates it by default and most people don't bother to change it.
39053880 ====
39063881
3882+-====
3883+-====
3884+-
39073885 .A branch and its commit history
39083886 -image::images/branch-and-history.png[A branch and its commit history.]
39093887 +image::images/branch-and-history.png[A branch and its commit history]
@@ -4020,8 +3998,13 @@ diff -au /tmp/book/03-git-branching/sections/nutshell.asc.tmp ../../git/progit2/
40203998 .Switching branches changes files in your working directory
40213999 ====
40224000 It's important to note that when you switch branches in Git, files in your working directory will change.
4023-@@ -101,18 +154,36 @@
4001+@@ -102,23 +152,38 @@
4002+ If Git cannot do it cleanly, it will not let you switch at all.
4003+ ====
40244004
4005+-====
4006+-====
4007+-
40254008 Let's make a few changes and commit again:
40264009
40274010 -Now your project history has diverged (see <<rdivergent_history>>).
@@ -4060,7 +4043,7 @@ diff -au /tmp/book/03-git-branching/sections/nutshell.asc.tmp ../../git/progit2/
40604043 Creating a new branch is as quick and simple as writing 41 bytes to a file (40 characters and a newline).
40614044
40624045 This is in sharp contrast to the way most older VCS tools branch, which involves copying all of the project's files into a second directory.
4063-@@ -121,3 +192,18 @@
4046+@@ -127,3 +192,18 @@
40644047 These features help encourage developers to create and use branches often.
40654048
40664049 Let's see why you should do so.
@@ -4080,7 +4063,7 @@ diff -au /tmp/book/03-git-branching/sections/nutshell.asc.tmp ../../git/progit2/
40804063 +- Return to your previously checked out branch: `git switch -`.
40814064 +====
40824065 diff -au /tmp/book/03-git-branching/sections/rebasing.asc.tmp ../../git/progit2/progit2/book/03-git-branching/sections/rebasing.asc
4083---- /tmp/book/03-git-branching/sections/rebasing.asc.tmp 2020-10-25 11:05:02.207637372 +0900
4066+--- /tmp/book/03-git-branching/sections/rebasing.asc.tmp 2020-10-25 13:21:06.735931790 +0900
40844067 +++ ../../git/progit2/progit2/book/03-git-branching/sections/rebasing.asc 2020-08-17 16:38:51.075694960 +0900
40854068 @@ -1,94 +1,144 @@
40864069 -[[r_rebasing]]
@@ -4342,7 +4325,7 @@ diff -au /tmp/book/03-git-branching/sections/rebasing.asc.tmp ../../git/progit2/
43424325 -In general the way to get the best of both worlds is to rebase local changes you've made but haven't shared yet before you push them in order to clean up your story, but never rebase anything you've pushed somewhere.
43434326 +You can get the best of both worlds: rebase local changes before pushing to clean up your work, but never rebase anything that you've pushed somewhere.
43444327 diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/progit2/progit2/book/03-git-branching/sections/remote-branches.asc
4345---- /tmp/book/03-git-branching/sections/remote-branches.asc.tmp 2020-10-25 11:05:02.213637709 +0900
4328+--- /tmp/book/03-git-branching/sections/remote-branches.asc.tmp 2020-10-25 13:21:06.744932269 +0900
43464329 +++ ../../git/progit2/progit2/book/03-git-branching/sections/remote-branches.asc 2020-07-04 16:36:46.723685453 +0900
43474330 @@ -1,23 +1,25 @@
43484331 -[[r_remote_branches]]
@@ -4376,7 +4359,14 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p
43764359 .``origin'' is not special
43774360 ====
43784361 Just like the branch name ``master'' does not have any special meaning in Git, neither does ``origin''.
4379-@@ -29,47 +31,62 @@
4362+@@ -25,54 +27,66 @@
4363+ If you run `git clone -o booyah` instead, then you will have `booyah/master` as your default remote branch.(((origin)))
4364+ ====
4365+
4366+-====
4367+-====
4368+-
4369+ .Server and local repositories after cloning
43804370 image::images/remote-branches-1.png[Server and local repositories after cloning.]
43814371
43824372 If you do some work on your local `master` branch, and, in the meantime, someone else pushes to `git.ourcompany.com` and updates its `master` branch, then your histories move forward differently.
@@ -4452,11 +4442,14 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p
44524442 .Don't type your password every time
44534443 ====
44544444 If you're using an HTTPS URL to push over, the Git server will ask you for your username and password for authentication.
4455-@@ -78,38 +95,87 @@
4445+@@ -81,53 +95,105 @@
44564446 If you don't want to type it every single time you push, you can set up a ``credential cache''.
44574447 The simplest is just to keep it in memory for a few minutes, which you can easily set up by running `git config --global credential.helper cache`.
44584448
44594449 -For more information on the various credential caching options available, see <<ch07-git-tools#r_credential_caching>>.
4450+-====
4451+-
4452+-====
44604453 +For more information on the various credential caching options available, see <<ch07-git-tools#_credential_caching>>.
44614454 ====
44624455
@@ -4548,7 +4541,12 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p
45484541 .Upstream shorthand
45494542 ====
45504543 When you have a tracking branch set up, you can reference its upstream branch with the `@{upstream}` or `@{u}` shorthand.
4551-@@ -119,6 +185,15 @@
4544+ So if you're on the `master` branch and it's tracking `origin/master`, you can say something like `git merge @{u}` instead of `git merge origin/master` if you wish.(((+++@{u}+++)))(((+++@{upstream}+++)))
4545+ ====
4546+
4547+-====
4548+-====
4549+-
45524550 If you want to see what tracking branches you have set up, you can use the `-vv` option to `git branch`.
45534551 This will list out your local branches with more information including what each branch is tracking and if your local branch is ahead, behind or both.
45544552
@@ -4564,7 +4562,7 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p
45644562 So here we can see that our `iss53` branch is tracking `origin/iss53` and is ``ahead'' by two, meaning that we have two commits locally that are not pushed to the server.
45654563 We can also see that our `master` branch is tracking `origin/master` and is up to date.
45664564 Next we can see that our `serverfix` branch is tracking the `server-fix-good` branch on our `teamone` server and is ahead by three and behind by one, meaning that there is one commit on the server we haven't merged in yet and three commits locally that we haven't pushed.
4567-@@ -127,22 +202,37 @@
4565+@@ -136,22 +202,37 @@
45684566 It's important to note that these numbers are only since the last time you fetched from each server.
45694567 This command does not reach out to the servers, it's telling you about what it has cached from these servers locally.
45704568 If you want totally up to date ahead and behind numbers, you'll need to fetch from all your remotes right before running this.
@@ -4606,7 +4604,7 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p
46064604 Basically all this does is remove the pointer from the server.
46074605 The Git server will generally keep the data there for a while until a garbage collection runs, so if it was accidentally deleted, it's often easy to recover.
46084606 diff -au /tmp/book/03-git-branching/sections/workflows.asc.tmp ../../git/progit2/progit2/book/03-git-branching/sections/workflows.asc
4609---- /tmp/book/03-git-branching/sections/workflows.asc.tmp 2020-10-25 11:05:02.218637990 +0900
4607+--- /tmp/book/03-git-branching/sections/workflows.asc.tmp 2020-10-25 13:21:06.753932747 +0900
46104608 +++ ../../git/progit2/progit2/book/03-git-branching/sections/workflows.asc 2020-07-04 16:36:46.723685453 +0900
46114609 @@ -1,35 +1,39 @@
46124610 === Branching Workflows
@@ -4682,7 +4680,7 @@ diff -au /tmp/book/03-git-branching/sections/workflows.asc.tmp ../../git/progit2
46824680 -When you're branching and merging, everything is being done only in your Git repository – no server communication is happening.
46834681 +When you're branching and merging, everything is being done only in your Git repository -- there is no communication with the server.
46844682 diff -au /tmp/book/04-git-server/sections/generating-ssh-key.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/generating-ssh-key.asc
4685---- /tmp/book/04-git-server/sections/generating-ssh-key.asc.tmp 2020-10-25 11:05:02.223638272 +0900
4683+--- /tmp/book/04-git-server/sections/generating-ssh-key.asc.tmp 2020-10-25 13:21:06.760933120 +0900
46864684 +++ ../../git/progit2/progit2/book/04-git-server/sections/generating-ssh-key.asc 2020-08-05 13:56:11.288918669 +0900
46874685 @@ -1,21 +1,57 @@
46884686 -[[r_generate_ssh_key]]
@@ -4748,7 +4746,7 @@ diff -au /tmp/book/04-git-server/sections/generating-ssh-key.asc.tmp ../../git/p
47484746 +
47494747 +For a more in-depth tutorial on creating an SSH key on multiple operating systems, see the GitHub guide on SSH keys at https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent[].
47504748 diff -au /tmp/book/04-git-server/sections/git-daemon.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/git-daemon.asc
4751---- /tmp/book/04-git-server/sections/git-daemon.asc.tmp 2020-10-25 11:05:02.227638497 +0900
4749+--- /tmp/book/04-git-server/sections/git-daemon.asc.tmp 2020-10-25 13:21:06.770933652 +0900
47524750 +++ ../../git/progit2/progit2/book/04-git-server/sections/git-daemon.asc 2020-06-28 16:44:50.925015352 +0900
47534751 @@ -1,33 +1,66 @@
47544752 === Git Daemon
@@ -4831,9 +4829,9 @@ diff -au /tmp/book/04-git-server/sections/git-daemon.asc.tmp ../../git/progit2/p
48314829 +
48324830 The presence of that file tells Git that it's OK to serve this project without authentication.
48334831 diff -au /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/git-on-a-server.asc
4834---- /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp 2020-10-25 11:05:02.232638778 +0900
4832+--- /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp 2020-10-25 13:21:06.778934077 +0900
48354833 +++ ../../git/progit2/progit2/book/04-git-server/sections/git-on-a-server.asc 2020-07-04 16:36:46.723685453 +0900
4836-@@ -1,42 +1,74 @@
4834+@@ -1,45 +1,74 @@
48374835 -[[r_git_on_the_server]]
48384836 +[[_getting_git_on_a_server]]
48394837 === Getting Git on a Server
@@ -4847,6 +4845,9 @@ diff -au /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp ../../git/prog
48474845 Actually setting up a production server within your infrastructure will certainly entail differences in security measures or operating system tools, but hopefully this will give you the general idea of what's involved.
48484846 ====
48494847
4848+-====
4849+-====
4850+-
48504851 -In order to initially set up any Git server, you have to export an existing repository into a new bare repository – a repository that doesn't contain a working directory.
48514852 +In order to initially set up any Git server, you have to export an existing repository into a new bare repository -- a repository that doesn't contain a working directory.
48524853 This is generally straightforward to do.
@@ -4865,13 +4866,13 @@ diff -au /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp ../../git/prog
48654866
48664867 -This is roughly equivalent to something like
48674868 +This is roughly equivalent to something like:
4868-+
4869+
4870+-There are a couple of minor differences in the configuration file; but for your purpose, this is close to the same thing.
48694871 +[source,console]
48704872 +----
48714873 +$ cp -Rf my_project/.git my_project.git
48724874 +----
4873-
4874--There are a couple of minor differences in the configuration file; but for your purpose, this is close to the same thing.
4875++
48754876 +There are a couple of minor differences in the configuration file but, for your purpose, this is close to the same thing.
48764877 It takes the Git repository by itself, without a working directory, and creates a directory specifically for it alone.
48774878
@@ -4923,7 +4924,7 @@ diff -au /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp ../../git/prog
49234924
49244925 In the next few sections, you'll see how to expand to more sophisticated setups.
49254926 This discussion will include not having to create user accounts for each user, adding public read access to repositories, setting up web UIs and more.
4926-@@ -46,23 +78,24 @@
4927+@@ -49,23 +78,24 @@
49274928
49284929 If you're a small outfit or are just trying out Git in your organization and have only a few developers, things can be simple for you.
49294930 One of the most complicated aspects of setting up a Git server is user management.
@@ -4956,7 +4957,7 @@ diff -au /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp ../../git/prog
49564957 Another way to do it is to have your SSH server authenticate from an LDAP server or some other centralized authentication source that you may already have set up.
49574958 As long as each user can get shell access on the machine, any SSH authentication mechanism you can think of should work.
49584959 diff -au /tmp/book/04-git-server/sections/gitlab.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/gitlab.asc
4959---- /tmp/book/04-git-server/sections/gitlab.asc.tmp 2020-10-25 11:05:02.237639059 +0900
4960+--- /tmp/book/04-git-server/sections/gitlab.asc.tmp 2020-10-25 13:21:06.787934556 +0900
49604961 +++ ../../git/progit2/progit2/book/04-git-server/sections/gitlab.asc 2020-09-07 09:33:11.247683703 +0900
49614962 @@ -2,60 +2,63 @@
49624963
@@ -5134,7 +5135,7 @@ diff -au /tmp/book/04-git-server/sections/gitlab.asc.tmp ../../git/progit2/progi
51345135 -One benefit to GitLab is that, once the server is set up and running, you'll rarely need to tweak a configuration file or access the server via SSH; most administration and general usage can be accomplished through the in-browser interface.
51355136 +One benefit to GitLab is that, once the server is set up and running, you'll rarely need to tweak a configuration file or access the server via SSH; most administration and general usage can be done through the in-browser interface.
51365137 diff -au /tmp/book/04-git-server/sections/gitweb.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/gitweb.asc
5137---- /tmp/book/04-git-server/sections/gitweb.asc.tmp 2020-10-25 11:05:02.242639340 +0900
5138+--- /tmp/book/04-git-server/sections/gitweb.asc.tmp 2020-10-25 13:21:06.793934875 +0900
51385139 +++ ../../git/progit2/progit2/book/04-git-server/sections/gitweb.asc 2020-07-04 16:36:46.723685453 +0900
51395140 @@ -4,25 +4,67 @@
51405141 Now that you have basic read/write and read-only access to your project, you may want to set up a simple web-based visualizer.
@@ -5209,7 +5210,7 @@ diff -au /tmp/book/04-git-server/sections/gitweb.asc.tmp ../../git/progit2/progi
52095210 Again, GitWeb can be served with any CGI or Perl capable web server; if you prefer to use something else, it shouldn't be difficult to set up.
52105211 At this point, you should be able to visit `http://gitserver/` to view your repositories online.
52115212 diff -au /tmp/book/04-git-server/sections/hosted.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/hosted.asc
5212---- /tmp/book/04-git-server/sections/hosted.asc.tmp 2020-10-25 11:05:02.246639565 +0900
5213+--- /tmp/book/04-git-server/sections/hosted.asc.tmp 2020-10-25 13:21:06.800935248 +0900
52135214 +++ ../../git/progit2/progit2/book/04-git-server/sections/hosted.asc 2020-07-04 16:36:46.725685477 +0900
52145215 @@ -5,6 +5,6 @@
52155216 Even if you set up and run your own server internally, you may still want to use a public hosting site for your open source code – it's generally easier for the open source community to find and help you with.
@@ -5220,7 +5221,7 @@ diff -au /tmp/book/04-git-server/sections/hosted.asc.tmp ../../git/progit2/progi
52205221
52215222 We'll cover using GitHub in detail in <<ch06-github#ch06-github>>, as it is the largest Git host out there and you may need to interact with projects hosted on it in any case, but there are dozens more to choose from should you not want to set up your own Git server.
52225223 diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/protocols.asc
5223---- /tmp/book/04-git-server/sections/protocols.asc.tmp 2020-10-25 11:05:02.252639902 +0900
5224+--- /tmp/book/04-git-server/sections/protocols.asc.tmp 2020-10-25 13:21:06.808935673 +0900
52245225 +++ ../../git/progit2/progit2/book/04-git-server/sections/protocols.asc 2020-07-04 16:36:46.726685489 +0900
52255226 @@ -1,39 +1,55 @@
52265227 === The Protocols
@@ -5287,7 +5288,7 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
52875288
52885289 ===== The Cons
52895290
5290-@@ -45,39 +61,59 @@
5291+@@ -45,43 +61,59 @@
52915292 A repository on NFS is often slower than the repository over SSH on the same server, allowing Git to run off local disks on each system.
52925293
52935294 Finally, this protocol does not protect the repository against accidental damage.
@@ -5308,9 +5309,9 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
53085309 +The newer version is often referred to as the _Smart_ HTTP protocol and the older way as _Dumb_ HTTP.
53095310 +We'll cover the newer Smart HTTP protocol first.
53105311
5312+ ===== Smart HTTP
5313+
53115314 -The ``smart'' HTTP protocol operates very similarly to the SSH or Git protocols but runs over standard HTTP/S ports and can use various HTTP authentication mechanisms, meaning it's often easier on the user than something like SSH, since you can use things like username/password basic authentication rather than having to set up SSH keys.
5312-+===== Smart HTTP
5313-+
53145315 +(((protocols, smart HTTP)))
53155316 +Smart HTTP operates very similarly to the SSH or Git protocols but runs over standard HTTPS ports and can use various HTTP authentication mechanisms, meaning it's often easier on the user than something like SSH, since you can use things like username/password authentication rather than having to set up SSH keys.
53165317
@@ -5321,8 +5322,8 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
53215322
53225323 -In fact, for services like GitHub, the URL you use to view the repository online (for example, ``https://github.com/schacon/simplegit[]'') is the same URL you can use to clone and, if you have access, push over.
53235324 +In fact, for services like GitHub, the URL you use to view the repository online (for example, https://github.com/schacon/simplegit[]) is the same URL you can use to clone and, if you have access, push over.
5324-+
5325-+===== Dumb HTTP
5325+
5326+ ===== Dumb HTTP
53265327
53275328 -If the server does not respond with a Git HTTP smart service, the Git client will try to fall back to the simpler ``dumb'' HTTP protocol.
53285329 +(((protocols, dumb HTTP)))
@@ -5348,20 +5349,20 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
53485349 The `post-update` hook that comes with Git by default runs the appropriate command (`git update-server-info`) to make HTTP fetching and cloning work properly.
53495350 -This command is run when you push to this repository (over SSH perhaps); then, other people can clone via something like
53505351 +This command is run when you push to this repository (over SSH perhaps); then, other people can clone via something like:
5351-+
5352+
5353+-In this particular case, we're using the `/var/www/htdocs` path that is common for Apache setups, but you can use any static web server – just put the bare repository in its path.
5354+-The Git data is served as basic static files (see <<ch10-git-internals#ch10-git-internals>> for details about exactly how it's served).
53525355 +[source,console]
53535356 +----
53545357 +$ git clone https://example.com/gitproject.git
53555358 +----
5356-
5357--In this particular case, we're using the `/var/www/htdocs` path that is common for Apache setups, but you can use any static web server – just put the bare repository in its path.
5358--The Git data is served as basic static files (see <<ch10-git-internals#ch10-git-internals>> for details about exactly how it's served).
5359++
53595360 +In this particular case, we're using the `/var/www/htdocs` path that is common for Apache setups, but you can use any static web server -- just put the bare repository in its path.
53605361 +The Git data is served as basic static files (see the <<ch10-git-internals#ch10-git-internals>> chapter for details about exactly how it's served).
53615362
53625363 Generally you would either choose to run a read/write Smart HTTP server or simply have the files accessible as read-only in the Dumb manner.
53635364 It's rare to run a mix of the two services.
5364-@@ -93,57 +129,69 @@
5365+@@ -97,57 +129,69 @@
53655366
53665367 You can also serve your repositories read-only over HTTPS, which means you can encrypt the content transfer; or you can go so far as to make the clients use specific signed SSL certificates.
53675368
@@ -5389,10 +5390,10 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
53895390 -SSH is also an authenticated network protocol; and because it's ubiquitous, it's generally easy to set up and use.
53905391 +This is because SSH access to servers is already set up in most places -- and if it isn't, it's easy to do.
53915392 +SSH is also an authenticated network protocol and, because it's ubiquitous, it's generally easy to set up and use.
5393++
5394++To clone a Git repository over SSH, you can specify an `ssh://` URL like this:
53925395
53935396 -To clone a Git repository over SSH, you can specify ssh:// URL like this:
5394-+To clone a Git repository over SSH, you can specify an `ssh://` URL like this:
5395-+
53965397 +[source,console]
53975398 +----
53985399 +$ git clone ssh://[user@]server/project.git
@@ -5451,7 +5452,7 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
54515452 It uses the same data-transfer mechanism as the SSH protocol but without the encryption and authentication overhead.
54525453
54535454 ===== The Cons
5454-@@ -152,6 +200,6 @@
5455+@@ -156,6 +200,6 @@
54555456 It's generally undesirable for the Git protocol to be the only access to your project.
54565457 Generally, you'll pair it with SSH or HTTPS access for the few developers who have push (write) access and have everyone else use `git://` for read-only access.
54575458 It's also probably the most difficult protocol to set up.
@@ -5460,7 +5461,7 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr
54605461 It also requires firewall access to port 9418, which isn't a standard port that corporate firewalls always allow.
54615462 Behind big corporate firewalls, this obscure port is commonly blocked.
54625463 diff -au /tmp/book/04-git-server/sections/setting-up-server.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/setting-up-server.asc
5463---- /tmp/book/04-git-server/sections/setting-up-server.asc.tmp 2020-10-25 11:05:02.256640128 +0900
5464+--- /tmp/book/04-git-server/sections/setting-up-server.asc.tmp 2020-10-25 13:21:06.817936152 +0900
54645465 +++ ../../git/progit2/progit2/book/04-git-server/sections/setting-up-server.asc 2020-06-28 16:44:50.927015646 +0900
54655466 @@ -1,41 +1,148 @@
54665467 -[[r_setting_up_server]]
@@ -5622,7 +5623,7 @@ diff -au /tmp/book/04-git-server/sections/setting-up-server.asc.tmp ../../git/pr
56225623 As the output states, you can also set up a directory in the `git` user's home directory that customizes the `git-shell` command a bit.
56235624 For instance, you can restrict the Git commands that the server will accept or you can customize the message that users see if they try to SSH in like that.
56245625 diff -au /tmp/book/04-git-server/sections/smart-http.asc.tmp ../../git/progit2/progit2/book/04-git-server/sections/smart-http.asc
5625---- /tmp/book/04-git-server/sections/smart-http.asc.tmp 2020-10-25 11:05:02.261640409 +0900
5626+--- /tmp/book/04-git-server/sections/smart-http.asc.tmp 2020-10-25 13:21:06.825936578 +0900
56265627 +++ ../../git/progit2/progit2/book/04-git-server/sections/smart-http.asc 2020-06-28 16:44:50.927015646 +0900
56275628 @@ -1,28 +1,62 @@
56285629 === Smart HTTP
@@ -5702,7 +5703,7 @@ diff -au /tmp/book/04-git-server/sections/smart-http.asc.tmp ../../git/progit2/p
57025703 +For more information on configuring authentication in Apache, check out the Apache docs here: https://httpd.apache.org/docs/current/howto/auth.html[]
57035704 ====
57045705 diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/progit2/progit2/book/05-distributed-git/sections/contributing.asc
5705---- /tmp/book/05-distributed-git/sections/contributing.asc.tmp 2020-10-25 11:05:02.269640859 +0900
5706+--- /tmp/book/05-distributed-git/sections/contributing.asc.tmp 2020-10-25 13:21:06.837937216 +0900
57065707 +++ ../../git/progit2/progit2/book/05-distributed-git/sections/contributing.asc 2020-08-29 09:58:24.050195768 +0900
57075708 @@ -1,11 +1,12 @@
57085709 -[[r_contributing_project]]
@@ -6153,7 +6154,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
61536154 ----
61546155 # Jessica's Machine
61556156 $ git fetch origin
6156-@@ -269,120 +374,254 @@
6157+@@ -269,123 +374,254 @@
61576158
61586159 Now, Jessica makes a couple of commits on the `featureB` branch:
61596160
@@ -6315,6 +6316,9 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
63156316 First, you'll probably want to clone the main repository, create a topic branch for the patch or patch series you're planning to contribute, and do your work there.
63166317 The sequence looks basically like this:
63176318
6319+-====
6320+-You may want to use `rebase -i` to squash your work down to a single commit, or rearrange the work in the commits to make the patch easier for the maintainer to review – see <<ch07-git-tools#r_rewriting_history>> for more information about interactive rebasing.
6321+-====
63186322 +[source,console]
63196323 +----
63206324 +$ git clone <url>
@@ -6325,10 +6329,9 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
63256329 + ... work ...
63266330 +$ git commit
63276331 +----
6328-+
6332+
63296333 +[NOTE]
63306334 ====
6331--You may want to use `rebase -i` to squash your work down to a single commit, or rearrange the work in the commits to make the patch easier for the maintainer to review – see <<ch07-git-tools#r_rewriting_history>> for more information about interactive rebasing.
63326335 +You may want to use `rebase -i` to squash your work down to a single commit, or rearrange the work in the commits to make the patch easier for the maintainer to review -- see <<ch07-git-tools#_rewriting_history>> for more information about interactive rebasing.
63336336 ====
63346337
@@ -6347,11 +6350,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
63476350 +If the maintainers `merge`, `rebase`, or `cherry-pick` your work, you'll eventually get it back via pulling from their repository anyhow.
63486351 +
63496352 +In any event, you can push your work with:
6350-
6351--Then you need to push your work up to it.
6352--It's easiest to push the topic branch you're working on up to your repository, rather than merging into your master branch and pushing that up.
6353--The reason is that if the work isn't accepted or is cherry picked, you don't have to rewind your master branch.
6354--If the maintainers merge, rebase, or cherry-pick your work, you'll eventually get it back via pulling from their repository anyhow:
6353++
63556354 +[source,console]
63566355 +----
63576356 +$ git push -u myfork featureA
@@ -6370,24 +6369,28 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
63706369 +The following changes since commit 1edee6b1d61823a2de3b09c160d7080b8d1b3a40:
63716370 +Jessica Smith (1):
63726371 + Create new function
6373-
6374--When your work has been pushed up to your fork, you need to notify the maintainer.
6375--This is often called a pull request, and you can either generate it via the website – GitHub has its own Pull Request mechanism that we'll go over in <<ch06-github#ch06-github>> – or you can run the `git request-pull` command and email the output to the project maintainer manually.
6372++
63766373 +are available in the git repository at:
63776374
6378--The `request-pull` command takes the base branch into which you want your topic branch pulled and the Git repository URL you want them to pull from, and outputs a summary of all the changes you're asking to be pulled in.
6379--For instance, if Jessica wants to send John a pull request, and she's done two commits on the topic branch she just pushed up, she can run this:
6375+-Then you need to push your work up to it.
6376+-It's easiest to push the topic branch you're working on up to your repository, rather than merging into your master branch and pushing that up.
6377+-The reason is that if the work isn't accepted or is cherry picked, you don't have to rewind your master branch.
6378+-If the maintainers merge, rebase, or cherry-pick your work, you'll eventually get it back via pulling from their repository anyhow:
63806379 + git://githost/simplegit.git featureA
63816380
6382--The output can be sent to the maintainer – it tells them where the work was branched from, summarizes the commits, and tells where to pull this work from.
6381+-When your work has been pushed up to your fork, you need to notify the maintainer.
6382+-This is often called a pull request, and you can either generate it via the website – GitHub has its own Pull Request mechanism that we'll go over in <<ch06-github#ch06-github>> – or you can run the `git request-pull` command and email the output to the project maintainer manually.
63836383 +Jessica Smith (2):
63846384 + Add limit to log function
63856385 + Increase log output to 30 from 25
6386-+
6386+
6387+-The `request-pull` command takes the base branch into which you want your topic branch pulled and the Git repository URL you want them to pull from, and outputs a summary of all the changes you're asking to be pulled in.
6388+-For instance, if Jessica wants to send John a pull request, and she's done two commits on the topic branch she just pushed up, she can run this:
63876389 + lib/simplegit.rb | 10 +++++++++-
63886390 + 1 files changed, 9 insertions(+), 1 deletions(-)
63896391 +----
6390-+
6392+
6393+-The output can be sent to the maintainer – it tells them where the work was branched from, summarizes the commits, and tells where to pull this work from.
63916394 +This output can be sent to the maintainer -- it tells them where the work was branched from, summarizes the commits, and identifies from where the new work is to be pulled.
63926395
63936396 On a project for which you're not the maintainer, it's generally easier to have a branch like `master` always track `origin/master` and to do your work in topic branches that you can easily discard if they're rejected.
@@ -6426,11 +6429,11 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
64266429 +$ git rebase origin/master
64276430 +$ git push -f myfork featureA
64286431 +----
6432++
6433++This rewrites your history to now look like <<psp_b>>.
64296434
64306435 -.Commit history after `featureA` work.
64316436 -image::images/public-small-2.png[Commit history after `featureA` work.]
6432-+This rewrites your history to now look like <<psp_b>>.
6433-+
64346437 +[[psp_b]]
64356438 +.Commit history after `featureA` work
64366439 +image::images/public-small-2.png[Commit history after `featureA` work]
@@ -6453,7 +6456,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
64536456 $ git commit
64546457 $ git push myfork featureBv2
64556458 ----
6456-@@ -391,61 +630,173 @@
6459+@@ -394,61 +630,173 @@
64576460 This means your future commit will have one parent only and allows you to introduce all the changes from another branch and then make more changes before recording the new commit.
64586461 Also the `--no-commit` option can be useful to delay the merge commit in case of the default merge process.
64596462
@@ -6638,7 +6641,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr
66386641 Next, you'll see how to work the other side of the coin: maintaining a Git project.
66396642 You'll learn how to be a benevolent dictator or integration manager.
66406643 diff -au /tmp/book/05-distributed-git/sections/distributed-workflows.asc.tmp ../../git/progit2/progit2/book/05-distributed-git/sections/distributed-workflows.asc
6641---- /tmp/book/05-distributed-git/sections/distributed-workflows.asc.tmp 2020-10-25 11:05:02.275641196 +0900
6644+--- /tmp/book/05-distributed-git/sections/distributed-workflows.asc.tmp 2020-10-25 13:21:06.846937695 +0900
66426645 +++ ../../git/progit2/progit2/book/05-distributed-git/sections/distributed-workflows.asc 2020-07-04 16:36:46.728685513 +0900
66436646 @@ -1,19 +1,21 @@
66446647 === Distributed Workflows
@@ -6761,7 +6764,7 @@ diff -au /tmp/book/05-distributed-git/sections/distributed-workflows.asc.tmp ../
67616764
67626765 These are some commonly used workflows that are possible with a distributed system like Git, but you can see that many variations are possible to suit your particular real-world workflow.
67636766 diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/progit2/progit2/book/05-distributed-git/sections/maintaining.asc
6764---- /tmp/book/05-distributed-git/sections/maintaining.asc.tmp 2020-10-25 11:05:02.282641590 +0900
6767+--- /tmp/book/05-distributed-git/sections/maintaining.asc.tmp 2020-10-25 13:21:06.856938227 +0900
67656768 +++ ../../git/progit2/progit2/book/05-distributed-git/sections/maintaining.asc 2020-07-07 09:30:48.190756402 +0900
67666769 @@ -1,64 +1,122 @@
67676770 === Maintaining a Project
@@ -7048,7 +7051,7 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
70487051 This command gives you a diff, but it may be misleading.
70497052 If your `master` branch has moved forward since you created the topic branch from it, then you'll get seemingly strange results.
70507053 This happens because Git directly compares the snapshots of the last commit of the topic branch you're on and the snapshot of the last commit on the `master` branch.
7051-@@ -131,165 +263,294 @@
7054+@@ -131,167 +263,294 @@
70527055
70537056 If `master` is a direct ancestor of your topic branch, this isn't a problem; but if the two histories have diverged, the diff will look like you're adding all the new stuff in your topic branch and removing everything unique to the `master` branch.
70547057
@@ -7067,8 +7070,7 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
70677070 +36c7dba2c95e6bbb78dfa822519ecfec6e1ca649
70687071 +$ git diff 36c7db
70697072 +----
7070-
7071--This command shows you only the work your current topic branch has introduced since its common ancestor with master.
7073++
70727074 +or, more concisely:
70737075 +
70747076 +[source,console]
@@ -7078,7 +7080,8 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
70787080 +
70797081 +However, neither of those is particularly convenient, so Git provides another shorthand for doing the same thing: the triple-dot syntax.
70807082 +In the context of the `git diff` command, you can put three periods after another branch to do a `diff` between the last commit of the branch you're on and its common ancestor with another branch:
7081-+
7083+
7084+-This command shows you only the work your current topic branch has introduced since its common ancestor with master.
70827085 +[source,console]
70837086 +----
70847087 +$ git diff master...contrib
@@ -7103,17 +7106,17 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
71037106 -When you have work in a topic branch that you've done or that someone has contributed and you've verified, you merge it into your master branch, delete the topic branch, and then continue the process.
71047107 -If we have a repository with work in two branches named `ruby_client` and `php_client` that looks like <<rmerwf_a>> and merge `ruby_client` first and then `php_client` next, then your history will end up looking like <<rmerwf_b>>.
71057108 +When you have work in a topic branch that you think you've completed, or work that someone else has contributed and you've verified, you merge it into your master branch, delete that just-merged topic branch, and repeat.
7106-+
7107-+For instance, if we have a repository with work in two branches named `ruby_client` and `php_client` that looks like <<merwf_a>>, and we merge `ruby_client` followed by `php_client`, your history will end up looking like <<merwf_b>>.
71087109
71097110 -.History with several topic branches.
71107111 -image::images/merging-workflows-1.png[History with several topic branches.]
7111-+[[merwf_a]]
7112-+.History with several topic branches
7113-+image::images/merging-workflows-1.png[History with several topic branches]
7112++For instance, if we have a repository with work in two branches named `ruby_client` and `php_client` that looks like <<merwf_a>>, and we merge `ruby_client` followed by `php_client`, your history will end up looking like <<merwf_b>>.
71147113
71157114 -.After a topic branch merge.
71167115 -image::images/merging-workflows-2.png[After a topic branch merge.]
7116++[[merwf_a]]
7117++.History with several topic branches
7118++image::images/merging-workflows-1.png[History with several topic branches]
7119++
71177120 +[[merwf_b]]
71187121 +.After a topic branch merge
71197122 +image::images/merging-workflows-2.png[After a topic branch merge]
@@ -7130,11 +7133,11 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
71307133 -
71317134 -.After a topic branch merge.
71327135 -image::images/merging-workflows-4.png[After a topic branch merge.]
7133--
7134--.After a project release.
7135--image::images/merging-workflows-5.png[After a topic branch release.]
71367136 +Each time you have a new topic branch to merge in (<<merwf_c>>), you merge it into `develop` (<<merwf_d>>); then, when you tag a release, you fast-forward `master` to wherever the now-stable `develop` branch is (<<merwf_e>>).
71377137
7138+-.After a project release.
7139+-image::images/merging-workflows-5.png[After a topic branch release.]
7140+-
71387141 -This way, when people clone your project's repository, they can either check out master to build the latest stable version and keep up to date on that easily, or they can check out develop, which is the more cutting-edge stuff.
71397142 -You can also continue this concept, having an integrate branch where all the work is merged together.
71407143 -Then, when the codebase on that branch is stable and passes tests, you merge it into a develop branch; and when that has proven itself stable for a while, you fast-forward your master branch.
@@ -7166,6 +7169,10 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
71667169
71677170 -.Managing a complex series of parallel contributed topic branches.
71687171 -image::images/large-merges-1.png[Managing a complex series of parallel contributed topic branches.]
7172+-
7173+-If the topics still need work, they're merged into `pu` instead.
7174+-When it's determined that they're totally stable, the topics are re-merged into `master` and are then rebuilt from the topics that were in `next` but didn't yet graduate to `master`.
7175+-This means `master` almost always moves forward, `next` is rebased occasionally, and `pu` is rebased even more often:
71697176 +[[merwf_f]]
71707177 +.Managing a complex series of parallel contributed topic branches
71717178 +image::images/large-merges-1.png[Managing a complex series of parallel contributed topic branches]
@@ -7175,10 +7182,6 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
71757182 +The `next` and `seen` branches are then rebuilt from the `master`.
71767183 +This means `master` almost always moves forward, `next` is rebased occasionally, and `seen` is rebased even more often:
71777184
7178--If the topics still need work, they're merged into `pu` instead.
7179--When it's determined that they're totally stable, the topics are re-merged into `master` and are then rebuilt from the topics that were in `next` but didn't yet graduate to `master`.
7180--This means `master` almost always moves forward, `next` is rebased occasionally, and `pu` is rebased even more often:
7181--
71827185 -.Merging contributed topic branches into long-term integration branches.
71837186 -image::images/large-merges-2.png[Merging contributed topic branches into long-term integration branches.]
71847187 +.Merging contributed topic branches into long-term integration branches
@@ -7234,8 +7237,8 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
72347237
72357238 Now you can remove your topic branch and drop the commits you didn't want to pull in.
72367239
7237-+===== Rerere
7238-+
7240+ ===== Rerere
7241+
72397242 +(((git commands, rerere)))(((rerere)))
72407243 If you're doing lots of merging and rebasing, or you're maintaining a long-lived topic branch, Git has a feature called ``rerere'' that can help.
72417244
@@ -7396,9 +7399,9 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro
73967399 +
73977400 You get a clean summary of all the commits since v1.0.1, grouped by author, that you can email to your list.
73987401 diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/progit2/progit2/book/06-github/sections/1-setting-up-account.asc
7399---- /tmp/book/06-github/sections/1-setting-up-account.asc.tmp 2020-10-25 11:05:02.288641927 +0900
7402+--- /tmp/book/06-github/sections/1-setting-up-account.asc.tmp 2020-10-25 13:21:06.863938599 +0900
74007403 +++ ../../git/progit2/progit2/book/06-github/sections/1-setting-up-account.asc 2020-07-04 16:36:46.730685537 +0900
7401-@@ -1,18 +1,22 @@
7404+@@ -1,21 +1,22 @@
74027405 === Account Setup and Configuration
74037406
74047407 +(((GitHub, user accounts)))
@@ -7419,14 +7422,16 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro
74197422 ====
74207423 -GitHub provides all of its functionality with free accounts, with the limitation that all of your projects are fully public (everyone has read access).
74217424 -GitHub's paid plans include a set number of private projects, but we won't be covering those in this book.
7425+-====
74227426 +GitHub provides almost all of its functionality with free accounts, except some advanced features.
7423-+
7427+
7428+-====
74247429 +GitHub's paid plans include advanced tools and features as well as increased limits for free services, but we won't be covering those in this book.
74257430 +To get more information about available plans and their comparison, visit https://github.com/pricing[].
74267431 ====
74277432
74287433 Clicking the Octocat logo at the top-left of the screen will take you to your dashboard page.
7429-@@ -20,40 +24,43 @@
7434+@@ -23,43 +24,43 @@
74307435
74317436 ==== SSH Access
74327437
@@ -7459,6 +7464,9 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro
74597464 You can name each of your keys (e.g. "My Laptop" or "Work Account") so that if you need to revoke a key later, you can easily tell which one you're looking for.
74607465 ====
74617466
7467+-====
7468+-====
7469+-
74627470 +[[_personal_avatar]]
74637471 ==== Your Avatar
74647472
@@ -7478,7 +7486,7 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro
74787486
74797487 Now anywhere you interact on the site, people will see your avatar next to your username.
74807488
7481-@@ -64,10 +71,11 @@
7489+@@ -70,10 +71,11 @@
74827490 The way that GitHub maps your Git commits to your user is by email address.
74837491 If you use multiple email addresses in your commits and you want GitHub to link them up properly, you need to add all the email addresses you have used to the Emails section of the admin section.
74847492
@@ -7493,9 +7501,9 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro
74937501 The second address is verified and so can be set as the primary if you wish to switch them.
74947502 The final address is unverified, meaning that you can't make it your primary address.
74957503 diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/progit2/book/06-github/sections/2-contributing.asc
7496---- /tmp/book/06-github/sections/2-contributing.asc.tmp 2020-10-25 11:05:02.295642321 +0900
7504+--- /tmp/book/06-github/sections/2-contributing.asc.tmp 2020-10-25 13:21:06.875939238 +0900
74977505 +++ ../../git/progit2/progit2/book/06-github/sections/2-contributing.asc 2020-09-30 09:43:39.046514305 +0900
7498-@@ -4,72 +4,131 @@
7506+@@ -4,77 +4,131 @@
74997507
75007508 ==== Forking Projects
75017509
@@ -7511,6 +7519,9 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
75117519 In GitHub, a ``fork'' is simply the same project in your own namespace, allowing you to make changes to a project publicly as a way to contribute in a more open manner.
75127520 ====
75137521
7522+-====
7523+-====
7524+-
75147525 -This way, projects don’t have to worry about adding users as collaborators to give them push access.
75157526 +This way, projects don't have to worry about adding users as collaborators to give them push access.
75167527 People can fork a project, push to it, and contribute their changes back to the original repository by creating what's called a Pull Request, which we'll cover next.
@@ -7525,9 +7536,11 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
75257536
75267537 After a few seconds, you'll be taken to your new project page, with your own writeable copy of the code.
75277538
7528-+
7539+-==== The GitHub Flow
7540+
7541+-==== GitHub Flow
75297542 +[[ch06-github_flow]]
7530- ==== The GitHub Flow
7543++==== The GitHub Flow
75317544
75327545 +(((GitHub, Flow)))
75337546 GitHub is designed around a particular collaboration workflow, centered on Pull Requests.
@@ -7650,13 +7663,16 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
76507663 If we click that green button, we'll see a screen that asks us to give our Pull Request a title and description.
76517664 It is almost always worthwhile to put some effort into this, since a good description helps the owner of the original project determine what you were trying to do, whether your proposed changes are correct, and whether accepting the changes would improve the original project.
76527665
7653-@@ -80,50 +139,69 @@
7666+@@ -85,56 +139,69 @@
76547667
76557668 When you hit the 'Create pull request' button on this screen, the owner of the project you forked will get a notification that someone is suggesting a change and will link to a page that has all of this information on it.
76567669
76577670 +[NOTE]
76587671 ====
76597672 -Though Pull Requests are used commonly for public projects like this when the contributor has a complete change ready to be made, it's also often used in internal projects _at the beginning_ of the development cycle. Since you can keep pushing to the topic branch even *after* the Pull Request is opened, it's often opened early and used as a way to iterate on work as a team within a context, rather than opened at the very end of the process.
7673+-====
7674+-
7675+-====
76607676 +Though Pull Requests are used commonly for public projects like this when the contributor has a complete change ready to be made, it's also often used in internal projects _at the beginning_ of the development cycle.
76617677 +Since you can keep pushing to the topic branch even *after* the Pull Request is opened, it's often opened early and used as a way to iterate on work as a team within a context, rather than opened at the very end of the process.
76627678 ====
@@ -7726,22 +7742,25 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
77267742 .Not Only Forks
77277743 ====
77287744 -It's important to note that you can also open a Pull Request between two branches in the same repository. If you're working on a feature with someone and you both have write access to the project, you can push a topic branch to the repository and open a Pull Request on it to the `master` branch of that same project to initiate the code review and discussion process. No forking necessary.
7745+-====
7746+-
7747+-====
77297748 +It's important to note that you can also open a Pull Request between two branches in the same repository.
77307749 +If you're working on a feature with someone and you both have write access to the project, you can push a topic branch to the repository and open a Pull Request on it to the `master` branch of that same project to initiate the code review and discussion process.
77317750 +No forking necessary.
77327751 ====
77337752
77347753 ==== Advanced Pull Requests
7735-@@ -132,151 +210,339 @@
7754+@@ -143,158 +210,339 @@
77367755
77377756 ===== Pull Requests as Patches
77387757
77397758 -It's important to understand that many projects don't really think of Pull Requests as queues of perfect patches that should apply cleanly in order, as most mailing list-based projects think of patch series contributions. Most GitHub projects think about Pull Request branches as iterative conversations around a proposed change, culminating in a unified diff that is applied by merging.
7740--
7741--This is an important distinction, because generally the change is suggested before the code is thought to be perfect, which is far more rare with mailing list based patch series contributions. This enables an earlier conversation with the maintainers so that arriving at the proper solution is more of a community effort. When code is proposed with a Pull Request and the maintainers or community suggest a change, the patch series is generally not re-rolled, but instead the difference is pushed as a new commit to the branch, moving the conversation forward with the context of the previous work intact.
77427759 +It's important to understand that many projects don't really think of Pull Requests as queues of perfect patches that should apply cleanly in order, as most mailing list-based projects think of patch series contributions.
77437760 +Most GitHub projects think about Pull Request branches as iterative conversations around a proposed change, culminating in a unified diff that is applied by merging.
77447761
7762+-This is an important distinction, because generally the change is suggested before the code is thought to be perfect, which is far more rare with mailing list based patch series contributions. This enables an earlier conversation with the maintainers so that arriving at the proper solution is more of a community effort. When code is proposed with a Pull Request and the maintainers or community suggest a change, the patch series is generally not re-rolled, but instead the difference is pushed as a new commit to the branch, moving the conversation forward with the context of the previous work intact.
7763+-
77457764 -For instance, if you go back and look again at <<r_pr_final>>, you'll notice that the contributor did not rebase his commit and send another Pull Request. Instead they added new commits and pushed them to the existing branch. This way if you go back and look at this Pull Request in the future, you can easily find all of the context of why decisions were made. Pushing the ``Merge'' button on the site purposefully creates a merge commit that references the Pull Request so that it's easy to go back and research the original conversation if necessary.
77467765 +This is an important distinction, because generally the change is suggested before the code is thought to be perfect, which is far more rare with mailing list based patch series contributions.
77477766 +This enables an earlier conversation with the maintainers so that arriving at the proper solution is more of a community effort.
@@ -7841,10 +7860,12 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
78417860 ===== References
78427861
78437862 -Your next question may be ``How do I reference the old Pull Request?''. It turns out there are many, many ways to reference other things almost anywhere you can write in GitHub.
7863+-
7864+-Let's start with how to cross-reference another Pull Request or an Issue. All Pull Requests and Issues are assigned numbers and they are unique within the project. For example, you can't have Pull Request #3 _and_ Issue #3. If you want to reference any Pull Request or Issue from any other one, you can simply put `#<num>` in any comment or description. You can also be more specific if the Issue or Pull request lives somewhere else; write `username#<num>` if you're referring to an Issue or Pull Request in a fork of the repository you're in, or `username/repo#<num>` to reference something in another repository.
78447865 +Your next question may be ``How do I reference the old Pull Request?''.
78457866 +It turns out there are many, many ways to reference other things almost anywhere you can write in GitHub.
78467867
7847--Let's start with how to cross-reference another Pull Request or an Issue. All Pull Requests and Issues are assigned numbers and they are unique within the project. For example, you can't have Pull Request #3 _and_ Issue #3. If you want to reference any Pull Request or Issue from any other one, you can simply put `#<num>` in any comment or description. You can also be more specific if the Issue or Pull request lives somewhere else; write `username#<num>` if you're referring to an Issue or Pull Request in a fork of the repository you're in, or `username/repo#<num>` to reference something in another repository.
7868+-Let's look at an example. Say we rebased the branch in the previous example, created a new pull request for it, and now we want to reference the old pull request from the new one. We also want to reference an issue in the fork of the repository and an issue in a completely different project. We can fill out the description just like <<r_pr_references>>.
78487869 +Let's start with how to cross-reference another Pull Request or an Issue.
78497870 +All Pull Requests and Issues are assigned numbers and they are unique within the project.
78507871 +For example, you can't have Pull Request #3 _and_ Issue #3.
@@ -7856,8 +7877,6 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
78567877 +We also want to reference an issue in the fork of the repository and an issue in a completely different project.
78577878 +We can fill out the description just like <<_pr_references>>.
78587879
7859--Let's look at an example. Say we rebased the branch in the previous example, created a new pull request for it, and now we want to reference the old pull request from the new one. We also want to reference an issue in the fork of the repository and an issue in a completely different project. We can fill out the description just like <<r_pr_references>>.
7860--
78617880 -.Cross references in a Pull Request.
78627881 +[[_pr_references]]
78637882 +.Cross references in a Pull Request
@@ -7891,14 +7910,16 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
78917910 -==== Markdown
78927911 +==== GitHub Flavored Markdown
78937912
7894--Linking to other Issues is just the beginning of interesting things you can do with almost any text box on GitHub. In Issue and Pull Request descriptions, comments, code comments and more, you can use what is called ``GitHub Flavored Markdown''. Markdown is like writing in plain text but which is rendered richly.
7913+-==== Markdown
78957914 +Linking to other Issues is just the beginning of interesting things you can do with almost any text box on GitHub.
78967915 +In Issue and Pull Request descriptions, comments, code comments and more, you can use what is called ``GitHub Flavored Markdown''.
78977916 +Markdown is like writing in plain text but which is rendered richly.
78987917
7899--See <<r_example_markdown>> for an example of how comments or text can be written and then rendered using Markdown.
7918+-Linking to other Issues is just the beginning of interesting things you can do with almost any text box on GitHub. In Issue and Pull Request descriptions, comments, code comments and more, you can use what is called ``GitHub Flavored Markdown''. Markdown is like writing in plain text but which is rendered richly.
79007919 +See <<_example_markdown>> for an example of how comments or text can be written and then rendered using Markdown.
79017920
7921+-See <<r_example_markdown>> for an example of how comments or text can be written and then rendered using Markdown.
7922+-
79027923 -.An example of Markdown as written and as rendered.
79037924 +[[_example_markdown]]
79047925 +.An example of GitHub Flavored Markdown as written and as rendered
@@ -7906,13 +7927,15 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
79067927
79077928 -===== GitHub Flavored Markdown
79087929 -
7909--The GitHub flavor of Markdown adds more things you can do beyond the basic Markdown syntax. These can all be really useful when creating useful Pull Request or Issue comments or descriptions.
7930+-===== GitHub Flavored Markdown
79107931 +The GitHub flavor of Markdown adds more things you can do beyond the basic Markdown syntax.
79117932 +These can all be really useful when creating useful Pull Request or Issue comments or descriptions.
79127933
7913--====== Task Lists
7934+-The GitHub flavor of Markdown adds more things you can do beyond the basic Markdown syntax. These can all be really useful when creating useful Pull Request or Issue comments or descriptions.
79147935 +===== Task Lists
79157936
7937+-====== Task Lists
7938+-
79167939 -The first really useful GitHub specific Markdown feature, especially for use in Pull Requests, is the Task List. A task list is a list of checkboxes of things you want to get done. Putting them into an Issue or Pull Request normally indicates things that you want to get done before you consider the item complete.
79177940 +The first really useful GitHub specific Markdown feature, especially for use in Pull Requests, is the Task List.
79187941 +A task list is a list of checkboxes of things you want to get done.
@@ -8028,32 +8051,34 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
80288051 +[source,text]
80298052 +----
80308053 +I :eyes: that :bug: and I :cold_sweat:.
8031-+
8054+
8055+-When rendered, it would look something like <<r_md_emoji>>.
80328056 +:trophy: for :microscope: it.
8033-+
8057+
8058+-.Heavy emoji commenting.
80348059 +:+1: and :sparkles: on this :ship:, it's :fire::poop:!
80358060 +
80368061 +:clap::tada::panda_face:
80378062 +----
8038-
8039--When rendered, it would look something like <<r_md_emoji>>.
8063++
80408064 +When rendered, it would look something like <<_md_emoji>>.
8041-
8042--.Heavy emoji commenting.
8065++
80438066 +[[_md_emoji]]
80448067 +.Heavy emoji commenting
80458068 image::images/markdown-07-emoji.png[Emoji]
80468069
80478070 Not that this is incredibly useful, but it does add an element of fun and emotion to a medium that is otherwise hard to convey emotion in.
80488071
8049-+
8072+-====
8073+-There are actually quite a number of web services that make use of emoji characters these days. A great cheat sheet to reference to find emoji that expresses what you want to say can be found at:
8074+
8075+-http://www.emoji-cheat-sheet.com
80508076 +[NOTE]
80518077 ====
8052--There are actually quite a number of web services that make use of emoji characters these days. A great cheat sheet to reference to find emoji that expresses what you want to say can be found at:
80538078 +There are actually quite a number of web services that make use of emoji characters these days.
80548079 +A great cheat sheet to reference to find emoji that expresses what you want to say can be found at:
80558080
8056--http://www.emoji-cheat-sheet.com
8081+-====
80578082 +https://www.webfx.com/tools/emoji-cheat-sheet/
80588083 ====
80598084
@@ -8133,7 +8158,7 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p
81338158 +Git will happily do this work for you silently, but it won't warn you if you make a commit to `master`, pull from `progit`, then push to `origin` -- all of those operations are valid with this setup.
81348159 +So you'll have to take care never to commit directly to `master`, since that branch effectively belongs to the upstream repository.
81358160 diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/progit2/book/06-github/sections/3-maintaining.asc
8136---- /tmp/book/06-github/sections/3-maintaining.asc.tmp 2020-10-25 11:05:02.303642771 +0900
8161+--- /tmp/book/06-github/sections/3-maintaining.asc.tmp 2020-10-25 13:21:06.885939770 +0900
81378162 +++ ../../git/progit2/progit2/book/06-github/sections/3-maintaining.asc 2020-07-04 16:36:46.732685561 +0900
81388163 @@ -1,4 +1,4 @@
81398164 -[[r_maintaining_gh_project]]
@@ -8141,7 +8166,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
81418166 === Maintaining a Project
81428167
81438168 Now that we're comfortable contributing to a project, let's look at the other side: creating, maintaining and administering your own project.
8144-@@ -6,33 +6,35 @@
8169+@@ -6,36 +6,35 @@
81458170 ==== Creating a New Repository
81468171
81478172 Let's create a new repository to share our project code with.
@@ -8184,11 +8209,14 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
81848209 +It is often preferable to share the HTTPS based URL for a public project, since the user does not have to have a GitHub account to access it for cloning.
81858210 Users will have to have an account and an uploaded SSH key to access your project if you give them the SSH URL.
81868211 -The HTTP one is also exactly the same URL they would paste into a browser to view the project there.
8212+-====
8213+-
8214+-====
81878215 +The HTTPS one is also exactly the same URL they would paste into a browser to view the project there.
81888216 ====
81898217
81908218 ==== Adding Collaborators
8191-@@ -43,16 +45,16 @@
8219+@@ -46,16 +45,16 @@
81928220
81938221 Click the ``Settings'' link at the bottom of the right-hand sidebar.
81948222
@@ -8209,7 +8237,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
82098237
82108238 ==== Managing Pull Requests
82118239
8212-@@ -63,12 +65,14 @@
8240+@@ -66,12 +65,14 @@
82138241
82148242 For these examples, let's assume you are ``tonychacon'' and you've created a new Arduino code project named ``fade''.
82158243
@@ -8226,7 +8254,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
82268254 image::images/maint-01-email.png[Pull Request email notification]
82278255
82288256 There are a few things to notice about this email.
8229-@@ -77,21 +81,26 @@
8257+@@ -80,21 +81,26 @@
82308258 It also gives you a few URLs that you can use from the command line.
82318259
82328260 If you notice the line that says `git pull <url> patch-1`, this is a simple way to merge in a remote branch without having to add a remote.
@@ -8256,7 +8284,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
82568284 image::images/maint-03-email-resp.png[Email response]
82578285
82588286 Once the code is in a place you like and want to merge it in, you can either pull the code down and merge it locally, either with the `git pull <url> <branch>` syntax we saw earlier, or by adding the fork as a remote and fetching and merging.
8259-@@ -99,26 +108,41 @@
8287+@@ -102,26 +108,41 @@
82608288 If the merge is trivial, you can also just hit the ``Merge'' button on the GitHub site.
82618289 This will do a ``non-fast-forward'' merge, creating a merge commit even if a fast-forward merge was possible.
82628290 This means that no matter what, every time you hit the merge button, a merge commit is created.
@@ -8302,7 +8330,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
83028330 Of course, if you're in your repository and you run `git ls-remote origin` or whatever remote you want to check, it will show you something similar to this.
83038331
83048332 If the repository is on GitHub and you have any Pull Requests that have been opened, you'll get these references that are prefixed with `refs/pull/`.
8305-@@ -130,6 +154,13 @@
8333+@@ -133,6 +154,13 @@
83068334
83078335 Now, you could do something like fetching the reference directly.
83088336
@@ -8316,7 +8344,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
83168344 This tells Git, ``Connect to the `origin` remote, and download the ref named `refs/pull/958/head`.''
83178345 Git happily obeys, and downloads everything you need to construct that ref, and puts a pointer to the commit you want under `.git/FETCH_HEAD`.
83188346 You can follow that up with `git merge FETCH_HEAD` into a branch you want to test it in, but that merge commit message looks a bit weird.
8319-@@ -139,21 +170,55 @@
8347+@@ -142,21 +170,55 @@
83208348 Open up `.git/config` in your favorite editor, and look for the `origin` remote.
83218349 It should look a bit like this:
83228350
@@ -8372,7 +8400,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
83728400 ===== Pull Requests on Pull Requests
83738401
83748402 Not only can you open Pull Requests that target the main or `master` branch, you can actually open a Pull Request targeting any branch in the network.
8375-@@ -164,7 +229,8 @@
8403+@@ -167,7 +229,8 @@
83768404 When you go to open a Pull Request, there is a box at the top of the page that specifies which branch you're requesting to pull to and which you're requesting to pull from.
83778405 If you hit the ``Edit'' button at the right of that box you can change not only the branches but also which fork.
83788406
@@ -8382,7 +8410,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
83828410 image::images/maint-04-target.png[PR targets]
83838411
83848412 Here you can fairly easily specify to merge your new branch into another Pull Request or another fork of the project.
8385-@@ -175,7 +241,7 @@
8413+@@ -178,7 +241,7 @@
83868414
83878415 In any comment you can start typing a `@` character and it will begin to autocomplete with the names and usernames of people who are collaborators or contributors in the project.
83888416
@@ -8391,7 +8419,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
83918419 image::images/maint-05-mentions.png[Mentions]
83928420
83938421 You can also mention a user who is not in that dropdown, but often the autocompleter can make it faster.
8394-@@ -188,7 +254,7 @@
8422+@@ -191,7 +254,7 @@
83958423 You will also be subscribed to something if you opened it, if you're watching the repository or if you comment on something.
83968424 If you no longer wish to receive notifications, there is an ``Unsubscribe'' button on the page you can click to stop receiving updates on it.
83978425
@@ -8400,7 +8428,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84008428 image::images/maint-06-unsubscribe.png[Unsubscribe]
84018429
84028430 ===== The Notifications Page
8403-@@ -196,7 +262,7 @@
8431+@@ -199,7 +262,7 @@
84048432 When we mention ``notifications'' here with respect to GitHub, we mean a specific way that GitHub tries to get in touch with you when events happen and there are a few different ways you can configure them.
84058433 If you go to the ``Notification center'' tab from the settings page, you can see some of the options you have.
84068434
@@ -8409,7 +8437,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84098437 image::images/maint-07-notifications.png[Notification center]
84108438
84118439 The two choices are to get notifications over ``Email'' and over ``Web'' and you can choose either, neither or both for when you actively participate in things and for activity on repositories you are watching.
8412-@@ -204,9 +270,10 @@
8440+@@ -207,9 +270,10 @@
84138441 ====== Web Notifications
84148442
84158443 Web notifications only exist on GitHub and you can only check them on GitHub.
@@ -8422,7 +8450,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84228450 image::images/maint-08-notifications-page.png[Notification center]
84238451
84248452 If you click on that, you will see a list of all the items you have been notified about, grouped by project.
8425-@@ -221,12 +288,25 @@
8453+@@ -224,12 +288,25 @@
84268454
84278455 Email notifications are the other way you can handle notifications through GitHub.
84288456 If you have this turned on you will get emails for each notification.
@@ -8450,21 +8478,9 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84508478
84518479 There are a couple of interesting things here.
84528480 If you want to highlight or re-route emails to this particular project or even Pull Request, the information in `Message-ID` gives you all the data in `<user>/<project>/<type>/<id>` format.
8453-@@ -241,6 +321,8 @@
8454-
8455- There are a couple of special files that GitHub will notice if they are present in your repository.
8456-
8457-+==== README
8458-+
8459- The first is the `README` file, which can be of nearly any format that GitHub recognizes as prose.
8460- For example, it could be `README`, `README.md`, `README.asciidoc`, etc.
8461- If GitHub sees a README file in your source, it will render it on the landing page of the project.
8462-@@ -256,10 +338,13 @@
8481+@@ -264,9 +341,10 @@
8482+ ==== CONTRIBUTING
84638483
8464- Since GitHub will render this file, you can embed images or links in it for added ease of understanding.
8465-
8466-+==== CONTRIBUTING
8467-+
84688484 The other special file that GitHub recognizes is the `CONTRIBUTING` file.
84698485 -If you have a file named `CONTRIBUTING` with any file extension, GitHub will show <<r_contrib_file>> when anyone starts opening a Pull Request.
84708486 +If you have a file named `CONTRIBUTING` with any file extension, GitHub will show <<_contrib_file>> when anyone starts opening a Pull Request.
@@ -8475,7 +8491,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84758491 image::images/maint-09-contrib.png[Contributing notice]
84768492
84778493 The idea here is that you can specify specific things you want or don't want in a Pull Request sent to your project.
8478-@@ -273,7 +358,8 @@
8494+@@ -280,7 +358,8 @@
84798495
84808496 If you are using a branch other than ``master'' as your default branch that you want people to open Pull Requests on or see by default, you can change that in your repository's settings page under the ``Options'' tab.
84818497
@@ -8485,7 +8501,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84858501 image::images/maint-10-default-branch.png[Default branch]
84868502
84878503 Simply change the default branch in the dropdown and that will be the default for all major operations from then on, including which branch is checked out by default when someone clones the repository.
8488-@@ -282,7 +368,8 @@
8504+@@ -289,7 +368,8 @@
84898505
84908506 If you would like to transfer a project to another user or an organization in GitHub, there is a ``Transfer ownership'' option at the bottom of the same ``Options'' tab of your repository settings page that allows you to do this.
84918507
@@ -8496,7 +8512,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr
84968512
84978513 This is helpful if you are abandoning a project and someone wants to take it over, or if your project is getting bigger and want to move it into an organization.
84988514 diff -au /tmp/book/06-github/sections/4-managing-organization.asc.tmp ../../git/progit2/progit2/book/06-github/sections/4-managing-organization.asc
8499---- /tmp/book/06-github/sections/4-managing-organization.asc.tmp 2020-10-25 11:05:02.309643108 +0900
8515+--- /tmp/book/06-github/sections/4-managing-organization.asc.tmp 2020-10-25 13:21:06.893940195 +0900
85008516 +++ ../../git/progit2/progit2/book/06-github/sections/4-managing-organization.asc 2020-07-04 16:36:46.732685561 +0900
85018517 @@ -1,6 +1,7 @@
85028518 -[[r_github_orgs]]
@@ -8564,7 +8580,7 @@ diff -au /tmp/book/06-github/sections/4-managing-organization.asc.tmp ../../git/
85648580
85658581 You can also filter down to specific types of events, specific places or specific people.
85668582 diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/progit2/book/06-github/sections/5-scripting.asc
8567---- /tmp/book/06-github/sections/5-scripting.asc.tmp 2020-10-25 11:05:02.315643446 +0900
8583+--- /tmp/book/06-github/sections/5-scripting.asc.tmp 2020-10-25 13:21:06.902940674 +0900
85688584 +++ ../../git/progit2/progit2/book/06-github/sections/5-scripting.asc 2020-07-04 16:36:46.733685573 +0900
85698585 @@ -5,7 +5,7 @@
85708586 Luckily for us, GitHub is really quite hackable in many ways.
@@ -8622,7 +8638,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
86228638 ----
86238639 require 'sinatra'
86248640 require 'json'
8625-@@ -97,16 +101,19 @@
8641+@@ -97,18 +101,19 @@
86268642 For each hook you can dig down into when it was delivered, if it was successful and the body and headers for both the request and the response.
86278643 This makes it incredibly easy to test and debug your hooks.
86288644
@@ -8638,6 +8654,8 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
86388654
86398655 ==== The GitHub API
86408656
8657+-==== GitHub API
8658+-
86418659 -Services and hooks give you a way to receive push notifications about events that happen on your repositories, but what if you need more information about these events? What if you need to automate something like adding collaborators or labeling issues?
86428660 +(((GitHub, API)))
86438661 +Services and hooks give you a way to receive push notifications about events that happen on your repositories, but what if you need more information about these events?
@@ -8645,7 +8663,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
86458663
86468664 This is where the GitHub API comes in handy.
86478665 GitHub has tons of API endpoints for doing nearly anything you can do on the website in an automated fashion.
8648-@@ -118,9 +125,47 @@
8666+@@ -120,9 +125,47 @@
86498667 This could be a user or read-only information on an open source project.
86508668 For example, if we want to know more about a user named ``schacon'', we can run something like this:
86518669
@@ -8693,7 +8711,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
86938711 ==== Commenting on an Issue
86948712
86958713 However, if you want to do an action on the website such as comment on an Issue or Pull Request or if you want to view or interact with private content, you'll need to authenticate.
8696-@@ -129,7 +174,8 @@
8714+@@ -131,7 +174,8 @@
86978715 You can use basic authentication with just your username and password, but generally it's a better idea to use a personal access token.
86988716 You can generate this from the ``Applications'' tab of your settings page.
86998717
@@ -8703,7 +8721,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
87038721 image::images/scripting-05-access-token.png[Access Token]
87048722
87058723 It will ask you which scopes you want for this token and a description.
8706-@@ -147,9 +193,32 @@
8724+@@ -149,9 +193,32 @@
87078725 Let's say we want to leave a comment on a specific issue, Issue #6.
87088726 To do so we have to do an HTTP POST request to `repos/<user>/<repo>/issues/<num>/comments` with the token we just generated as an Authorization header.
87098727
@@ -8729,16 +8747,16 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
87298747 + "body": "A new comment, :+1:"
87308748 +}
87318749 +----
8750++
8751++Now if you go to that issue, you can see the comment that we just successfully posted as in <<_api_comment>>.
87328752
87338753 -.A comment posted from the GitHub API.
8734-+Now if you go to that issue, you can see the comment that we just successfully posted as in <<_api_comment>>.
8735-+
87368754 +[[_api_comment]]
87378755 +.A comment posted from the GitHub API
87388756 image::images/scripting-06-comment.png[API Comment]
87398757
87408758 You can use the API to do just about anything you can do on the website -- creating and setting milestones, assigning people to Issues and Pull Requests, creating and changing labels, accessing commit data, creating new commits and branches, opening, closing or merging Pull Requests, creating and editing teams, commenting on lines of code in a Pull Request, searching the site and on and on.
8741-@@ -164,6 +233,7 @@
8759+@@ -166,6 +233,7 @@
87428760
87438761 Let's say you set up a webhook on your repository that hits a small web service that checks for a `Signed-off-by` string in the commit message.
87448762
@@ -8746,7 +8764,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
87468764 ----
87478765 require 'httparty'
87488766 require 'sinatra'
8749-@@ -212,18 +282,21 @@
8767+@@ -214,9 +282,10 @@
87508768 In this case you can send a state ('success', 'failure', 'error'), a description of what happened, a target URL the user can go to for more information and a ``context'' in case there are multiple statuses for a single commit.
87518769 For example, a testing service may provide a status and a validation service like this may also provide a status -- the ``context'' field is how they're differentiated.
87528770
@@ -8759,11 +8777,8 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
87598777 image::images/scripting-07-status.png[Commit status]
87608778
87618779 You can now see a little green check mark next to the commit that has a ``Signed-off-by'' string in the message and a red cross through the one where the author forgot to sign off.
8762- You can also see that the Pull Request takes the status of the last commit on the branch and warns you if it is a failure.
8763- This is really useful if you're using this API for test results so you don't accidentally merge something where the last commit is failing tests.
8780+@@ -227,7 +296,7 @@
87648781
8765-+==== Octokit
8766-+
87678782 Though we've been doing nearly everything through `curl` and simple HTTP requests in these examples, several open-source libraries exist that make this API available in a more idiomatic way.
87688783 At the time of this writing, the supported languages include Go, Objective-C, Ruby, and .NET.
87698784 -Check out http://github.com/octokit[] for more information on these, as they handle much of the HTTP for you.
@@ -8772,7 +8787,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog
87728787 Hopefully these tools can help you customize and modify GitHub to work better for your specific workflows.
87738788 For complete documentation on the entire API as well as guides for common tasks, check out https://developer.github.com[].
87748789 diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/advanced-merging.asc
8775---- /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp 2020-10-25 11:05:02.322643839 +0900
8790+--- /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp 2020-10-25 13:21:06.914941312 +0900
87768791 +++ ../../git/progit2/progit2/book/07-git-tools/sections/advanced-merging.asc 2020-07-04 16:36:46.733685573 +0900
87778792 @@ -1,4 +1,4 @@
87788793 -[[r_advanced_merging]]
@@ -9059,7 +9074,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
90599074 ===== Checking Out Conflicts
90609075
90619076 Perhaps we're not happy with the resolution at this point for some reason, or maybe manually editing one or both sides still didn't work well and we need more context.
9062-@@ -107,46 +309,128 @@
9077+@@ -107,48 +309,128 @@
90639078 Let's change up the example a little.
90649079 For this example, we have two longer lived branches that each have a few commits in them but create a legitimate content conflict when merged.
90659080
@@ -9097,7 +9112,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
90979112 +def hello
90989113 +<<<<<<< HEAD
90999114 + puts 'hola world'
9100-+=======
9115+ =======
91019116 + puts 'hello mundo'
91029117 +>>>>>>> mundo
91039118 +end
@@ -9135,7 +9150,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
91359150 + puts 'hola world'
91369151 +||||||| base
91379152 + puts 'hello world'
9138-+=======
9153+ =======
91399154 + puts 'hello mundo'
91409155 +>>>>>>> theirs
91419156 +end
@@ -9191,7 +9206,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
91919206 If you run that with the `-p` option instead, you get just the diffs to the file that ended up in conflict.
91929207 This can be *really* helpful in quickly giving you the context you need to help understand why something conflicts and how to more intelligently resolve it.
91939208
9194-@@ -157,20 +441,91 @@
9209+@@ -159,20 +441,91 @@
91959210
91969211 When you run `git diff` directly after a merge conflict, it will give you information in a rather unique diff output format.
91979212
@@ -9284,7 +9299,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
92849299 ==== Undoing Merges
92859300
92869301 Now that you know how to create a merge commit, you'll probably make some by mistake.
9287-@@ -180,7 +535,7 @@
9302+@@ -182,7 +535,7 @@
92889303 Let's say you started work on a topic branch, accidentally merged it into `master`, and now your commit history looks like this:
92899304
92909305 .Accidental merge commit
@@ -9293,7 +9308,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
92939308
92949309 There are two ways to approach this problem, depending on what your desired outcome is.
92959310
9296-@@ -190,9 +545,9 @@
9311+@@ -192,9 +545,9 @@
92979312 In most cases, if you follow the errant `git merge` with `git reset --hard HEAD~`, this will reset the branch pointers so they look like this:
92989313
92999314 .History after `git reset --hard HEAD~`
@@ -9305,7 +9320,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
93059320 Here's a quick refresher: `reset --hard` usually goes through three steps:
93069321
93079322 . Move the branch HEAD points to.
9308-@@ -201,14 +556,21 @@
9323+@@ -203,14 +556,21 @@
93099324 . Make the working directory look like the index.
93109325
93119326 The downside of this approach is that it's rewriting history, which can be problematic with a shared repository.
@@ -9328,7 +9343,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
93289343 The `-m 1` flag indicates which parent is the ``mainline'' and should be kept.
93299344 When you invoke a merge into `HEAD` (`git merge topic`), the new commit has two parents: the first one is `HEAD` (`C6`), and the second is the tip of the branch being merged in (`C4`).
93309345 In this case, we want to undo all the changes introduced by merging in parent #2 (`C4`), while keeping all the content from parent #1 (`C6`).
9331-@@ -216,21 +578,34 @@
9346+@@ -218,21 +578,34 @@
93329347 The history with the revert commit looks like this:
93339348
93349349 .History after `git revert -m 1`
@@ -9366,7 +9381,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
93669381
93679382 In this example, `M` and `^M` cancel out.
93689383 `^^M` effectively merges in the changes from `C3` and `C4`, and `C8` merges in the changes from `C7`, so now `topic` is fully merged.
9369-@@ -255,8 +630,28 @@
9384+@@ -257,8 +630,28 @@
93709385
93719386 If we go back to the ``hello world'' example we were using before, we can see that merging in our branch causes conflicts.
93729387
@@ -9395,7 +9410,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
93959410 In that case, instead of getting conflict markers in the file with ``hello mundo'' on one side and ``hola world'' on the other, it will simply pick ``hola world''.
93969411 However, all the other non-conflicting changes on that branch are merged successfully in.
93979412
9398-@@ -269,9 +664,19 @@
9413+@@ -271,9 +664,19 @@
93999414 It will record a new merge commit with both branches as parents, but it will not even look at the branch you're merging in.
94009415 It will simply record as the result of the merge the exact code in your current branch.
94019416
@@ -9416,7 +9431,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog
94169431 +
94179432 +include::subtree-merges.asc[]
94189433 diff -au /tmp/book/07-git-tools/sections/bundling.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/bundling.asc
9419---- /tmp/book/07-git-tools/sections/bundling.asc.tmp 2020-10-25 11:05:02.328644177 +0900
9434+--- /tmp/book/07-git-tools/sections/bundling.asc.tmp 2020-10-25 13:21:06.922941738 +0900
94209435 +++ ../../git/progit2/progit2/book/07-git-tools/sections/bundling.asc 2020-06-28 16:44:50.939017414 +0900
94219436 @@ -1,4 +1,4 @@
94229437 -[[r_bundling]]
@@ -9585,7 +9600,7 @@ diff -au /tmp/book/07-git-tools/sections/bundling.asc.tmp ../../git/progit2/prog
95859600
95869601 So, `git bundle` can be really useful for sharing or doing network-type operations when you don't have the proper network or shared repository to do so.
95879602 diff -au /tmp/book/07-git-tools/sections/credentials.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/credentials.asc
9588---- /tmp/book/07-git-tools/sections/credentials.asc.tmp 2020-10-25 11:05:02.334644514 +0900
9603+--- /tmp/book/07-git-tools/sections/credentials.asc.tmp 2020-10-25 13:21:06.928942057 +0900
95899604 +++ ../../git/progit2/progit2/book/07-git-tools/sections/credentials.asc 2020-06-28 16:44:50.939017414 +0900
95909605 @@ -1,6 +1,8 @@
95919606 -[[r_credential_caching]]
@@ -9741,7 +9756,7 @@ diff -au /tmp/book/07-git-tools/sections/credentials.asc.tmp ../../git/progit2/p
97419756 +
97429757 As you can see, extending this system is pretty straightforward, and can solve some common problems for you and your team.
97439758 diff -au /tmp/book/07-git-tools/sections/debugging.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/debugging.asc
9744---- /tmp/book/07-git-tools/sections/debugging.asc.tmp 2020-10-25 11:05:02.339644795 +0900
9759+--- /tmp/book/07-git-tools/sections/debugging.asc.tmp 2020-10-25 13:21:06.934942377 +0900
97459760 +++ ../../git/progit2/progit2/book/07-git-tools/sections/debugging.asc 2020-06-28 16:44:50.939017414 +0900
97469761 @@ -1,62 +1,149 @@
97479762 === Debugging with Git
@@ -9913,7 +9928,7 @@ diff -au /tmp/book/07-git-tools/sections/debugging.asc.tmp ../../git/progit2/pro
99139928 Doing so automatically runs `test-error.sh` on each checked-out commit until Git finds the first broken commit.
99149929 You can also run something like `make` or `make tests` or whatever you have that runs automated tests for you.
99159930 diff -au /tmp/book/07-git-tools/sections/interactive-staging.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/interactive-staging.asc
9916---- /tmp/book/07-git-tools/sections/interactive-staging.asc.tmp 2020-10-25 11:05:02.345645133 +0900
9931+--- /tmp/book/07-git-tools/sections/interactive-staging.asc.tmp 2020-10-25 13:21:06.946943015 +0900
99179932 +++ ../../git/progit2/progit2/book/07-git-tools/sections/interactive-staging.asc 2020-06-28 16:44:50.939017414 +0900
99189933 @@ -1,57 +1,204 @@
99199934 -[[r_interactive_staging]]
@@ -10146,7 +10161,7 @@ diff -au /tmp/book/07-git-tools/sections/interactive-staging.asc.tmp ../../git/p
1014610161 +Furthermore, you can use patch mode for partially resetting files with the `git reset --patch` command, for checking out parts of files with the `git checkout --patch` command and for stashing parts of files with the `git stash save --patch` command.
1014710162 We'll go into more details on each of these as we get to more advanced usages of these commands.
1014810163 diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/replace.asc
10149---- /tmp/book/07-git-tools/sections/replace.asc.tmp 2020-10-25 11:05:02.350645414 +0900
10164+--- /tmp/book/07-git-tools/sections/replace.asc.tmp 2020-10-25 13:21:06.954943440 +0900
1015010165 +++ ../../git/progit2/progit2/book/07-git-tools/sections/replace.asc 2020-07-04 16:36:46.733685573 +0900
1015110166 @@ -1,13 +1,13 @@
1015210167 -[[r_replace]]
@@ -10236,7 +10251,7 @@ diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progi
1023610251 It's useful in this case to create a base commit that has instructions on how to expand the history, so other developers know what to do if they hit the first commit in the truncated history and need more.
1023710252 So, what we're going to do is create an initial commit object as our base point with instructions, then rebase the remaining commits (four and five) on top of it.
1023810253
10239-@@ -34,37 +83,124 @@
10254+@@ -34,40 +83,124 @@
1024010255 So, our base commit will be based off of that tree.
1024110256 We can create our base commit using the `commit-tree` command, which just takes a tree and will give us a brand new, parentless commit object SHA-1 back.
1024210257
@@ -10255,8 +10270,10 @@ diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progi
1025510270 +You can read more about plumbing commands in <<ch10-git-internals#_plumbing_porcelain>>.
1025610271 =====
1025710272
10273+-=====
10274+-=====
1025810275 +image::images/replace3.png[]
10259-+
10276+
1026010277 OK, so now that we have a base commit, we can rebase the rest of our history on top of that with `git rebase --onto`.
1026110278 The `--onto` argument will be the SHA-1 we just got back from `commit-tree` and the rebase point will be the third commit (the parent of the first commit we want to keep, `9c68fdc`):
1026210279
@@ -10364,9 +10381,9 @@ diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progi
1036410381 This means that it's easy to share our replacement with others, because we can push this to our server and other people can easily download it.
1036510382 This is not that helpful in the history grafting scenario we've gone over here (since everyone would be downloading both histories anyhow, so why separate them?) but it can be useful in other circumstances.
1036610383 diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/rerere.asc
10367---- /tmp/book/07-git-tools/sections/rerere.asc.tmp 2020-10-25 11:05:02.356645752 +0900
10384+--- /tmp/book/07-git-tools/sections/rerere.asc.tmp 2020-10-25 13:21:06.960943760 +0900
1036810385 +++ ../../git/progit2/progit2/book/07-git-tools/sections/rerere.asc 2020-06-28 16:44:50.940017561 +0900
10369-@@ -1,67 +1,252 @@
10386+@@ -1,68 +1,252 @@
1037010387 -[[r_rerere]]
1037110388 +[[ref_rerere]]
1037210389 === Rerere
@@ -10574,8 +10591,6 @@ diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit
1057410591 -You can also recreate the conflicted file state with the `checkout` command:
1057510592 +Also, `git diff` will show you how it was automatically re-resolved:
1057610593
10577--We saw an example of this in <<r_advanced_merging>>.
10578--For now though, let's re-resolve it by just running `rerere` again:
1057910594 +[source,console]
1058010595 +----
1058110596 +$ git diff
@@ -10606,7 +10621,9 @@ diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit
1060610621 +def hello
1060710622 +<<<<<<< ours
1060810623 + puts 'hola world'
10609-+=======
10624+ =======
10625+-We saw an example of this in <<r_advanced_merging>>.
10626+-For now though, let's re-resolve it by just running `rerere` again:
1061010627 + puts 'hello mundo'
1061110628 +>>>>>>> theirs
1061210629 +end
@@ -10640,7 +10657,7 @@ diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit
1064010657 +
1064110658 +So, if you do a lot of re-merges, or want to keep a topic branch up to date with your `master` branch without a ton of merges, or you rebase often, you can turn on `rerere` to help your life out a bit.
1064210659 diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/reset.asc
10643---- /tmp/book/07-git-tools/sections/reset.asc.tmp 2020-10-25 11:05:02.362646089 +0900
10660+--- /tmp/book/07-git-tools/sections/reset.asc.tmp 2020-10-25 13:21:06.969944238 +0900
1064410661 +++ ../../git/progit2/progit2/book/07-git-tools/sections/reset.asc 2020-07-04 16:36:46.733685573 +0900
1064510662 @@ -1,16 +1,16 @@
1064610663 -[[r_git_reset]]
@@ -10664,8 +10681,12 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1066410681
1066510682 Git as a system manages and manipulates three trees in its normal operation:
1066610683
10667-@@ -26,63 +26,112 @@
10684+@@ -24,67 +24,114 @@
10685+
10686+ ===== The HEAD
1066810687
10688+-===== HEAD
10689+-
1066910690 HEAD is the pointer to the current branch reference, which is in turn a pointer to the last commit made on that branch.
1067010691 That means HEAD will be the parent of the next commit that is created.
1067110692 -It's generally simplest to think of HEAD as the snapshot of *your last commit*.
@@ -10689,9 +10710,9 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1068910710 +100644 blob 8f94139338f9404f2... Rakefile
1069010711 +040000 tree 99f1a6d12cb4b6f19... lib
1069110712 +----
10692-
10693-+The Git `cat-file` and `ls-tree` commands are ``plumbing'' commands that are used for lower level things and not really used in day-to-day work, but they help us see what's going on here.
1069410713 +
10714++The Git `cat-file` and `ls-tree` commands are ``plumbing'' commands that are used for lower level things and not really used in day-to-day work, but they help us see what's going on here.
10715+
1069510716 +[[_the_index]]
1069610717 ===== The Index
1069710718
@@ -10749,16 +10770,16 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1074910770 We'll call this *v1* of the file, and we'll indicate it in blue.
1075010771 -Now we run `git init`, which will create a Git repository with a HEAD reference which points to an unborn branch (`master` doesn't exist yet).
1075110772 +Now we run `git init`, which will create a Git repository with a HEAD reference which points to the unborn `master` branch.
10752-+
10753-+image::images/reset-ex1.png[]
1075410773
1075510774 -At this point, only the Working Directory tree has any content.
10756-+At this point, only the working directory tree has any content.
10775++image::images/reset-ex1.png[]
1075710776
1075810777 -Now we want to commit this file, so we use `git add` to take content in the Working Directory and copy it to the Index.
10759-+Now we want to commit this file, so we use `git add` to take content in the working directory and copy it to the index.
10778++At this point, only the working directory tree has any content.
1076010779
1076110780 -Then we run `git commit`, which takes the contents of the Index and saves it as a permanent snapshot, creates a commit object which points to that snapshot, and updates `master` to point to that commit.
10781++Now we want to commit this file, so we use `git add` to take content in the working directory and copy it to the index.
10782++
1076210783 +image::images/reset-ex2.png[]
1076310784 +
1076410785 +Then we run `git commit`, which takes the contents of the index and saves it as a permanent snapshot, creates a commit object which points to that snapshot, and updates `master` to point to that commit.
@@ -10775,12 +10796,12 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1077510796 -If we run `git status` right now, we'll see the file in red as ``Changes not staged for commit,'' because that entry differs between the Index and the Working Directory.
1077610797 -Next we run `git add` on it to stage it into our Index.
1077710798 +image::images/reset-ex4.png[]
10778-+
10779-+If we run `git status` right now, we'll see the file in red as ``Changes not staged for commit'', because that entry differs between the index and the working directory.
10780-+Next we run `git add` on it to stage it into our index.
1078110799
1078210800 -At this point if we run `git status` we will see the file in green
1078310801 -under ``Changes to be committed'' because the Index and HEAD differ – that is, our proposed next commit is now different from our last commit.
10802++If we run `git status` right now, we'll see the file in red as ``Changes not staged for commit'', because that entry differs between the index and the working directory.
10803++Next we run `git add` on it to stage it into our index.
10804++
1078410805 +image::images/reset-ex5.png[]
1078510806 +
1078610807 +At this point, if we run `git status`, we will see the file in green under ``Changes to be committed'' because the index and HEAD differ -- that is, our proposed next commit is now different from our last commit.
@@ -10796,7 +10817,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1079610817
1079710818 ==== The Role of Reset
1079810819
10799-@@ -91,6 +140,8 @@
10820+@@ -93,6 +140,8 @@
1080010821 For the purposes of these examples, let's say that we've modified `file.txt` again and committed it a third time.
1080110822 So now our history looks like this:
1080210823
@@ -10805,7 +10826,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1080510826 Let's now walk through exactly what `reset` does when you call it.
1080610827 It directly manipulates these three trees in a simple and predictable way.
1080710828 It does up to three basic operations.
10808-@@ -101,19 +152,23 @@
10829+@@ -103,19 +152,23 @@
1080910830 This isn't the same as changing HEAD itself (which is what `checkout` does); `reset` moves the branch that HEAD is pointing to.
1081010831 This means if HEAD is set to the `master` branch (i.e. you're currently on the `master` branch), running `git reset 9e5e6a4` will start by making `master` point to `9e5e6a4`.
1081110832
@@ -10833,7 +10854,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1083310854
1083410855 If you specify the `--mixed` option, `reset` will stop at this point.
1083510856 This is also the default, so if you specify no option at all (just `git reset HEAD~` in this case), this is where the command will stop.
10836-@@ -123,69 +178,82 @@
10857+@@ -125,69 +178,82 @@
1083710858
1083810859 ===== Step 3: Updating the Working Directory (--hard)
1083910860
@@ -10933,7 +10954,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1093310954 Now you can see that your reachable history, the history you would push, now looks like you had one commit with `file-a.txt` v1, then a second that both modified `file-a.txt` to v3 and added `file-b.txt`.
1093410955 The commit with the v2 version of the file is no longer in the history.
1093510956
10936-@@ -199,11 +267,11 @@
10957+@@ -201,11 +267,11 @@
1093710958 Running `git checkout [branch]` is pretty similar to running `git reset --hard [branch]` in that it updates all three trees for you to look like `[branch]`, but there are two important differences.
1093810959
1093910960 First, unlike `reset --hard`, `checkout` is working-directory safe; it will check to make sure it's not blowing away files that have changes to them.
@@ -10948,7 +10969,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1094810969
1094910970 For instance, say we have `master` and `develop` branches which point at different commits, and we're currently on `develop` (so HEAD points to it).
1095010971 If we run `git reset master`, `develop` itself will now point to the same commit that `master` does.
10951-@@ -213,11 +281,13 @@
10972+@@ -215,11 +281,13 @@
1095210973 So, in both cases we're moving HEAD to point to commit A, but _how_ we do so is very different.
1095310974 `reset` will move the branch HEAD points to, `checkout` moves HEAD itself.
1095410975
@@ -10963,7 +10984,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1096310984
1096410985 Also, like `git reset` and `git add`, `checkout` will accept a `--patch` option to allow you to selectively revert file contents on a hunk-by-hunk basis.
1096510986
10966-@@ -227,7 +297,7 @@
10987+@@ -229,7 +297,7 @@
1096710988
1096810989 Here's a cheat-sheet for which commands affect which trees.
1096910990 The ``HEAD'' column reads ``REF'' if that command moves the reference (branch) that HEAD points to, and ``HEAD'' if it moves HEAD itself.
@@ -10972,7 +10993,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1097210993
1097310994 [options="header", cols="3,1,1,1,1"]
1097410995 |================================
10975-@@ -236,8 +306,8 @@
10996+@@ -238,8 +306,8 @@
1097610997 | `reset --soft [commit]` | REF | NO | NO | YES
1097710998 | `reset [commit]` | REF | YES | NO | YES
1097810999 | `reset --hard [commit]` | REF | YES | YES | *NO*
@@ -10985,7 +11006,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2
1098511006 +| `checkout [commit] <paths>` | NO | YES | YES | *NO*
1098611007 |================================
1098711008 diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/revision-selection.asc
10988---- /tmp/book/07-git-tools/sections/revision-selection.asc.tmp 2020-10-25 11:05:02.369646483 +0900
11009+--- /tmp/book/07-git-tools/sections/revision-selection.asc.tmp 2020-10-25 13:21:06.977944664 +0900
1098911010 +++ ../../git/progit2/progit2/book/07-git-tools/sections/revision-selection.asc 2020-10-24 08:43:10.529548324 +0900
1099011011 @@ -1,36 +1,76 @@
1099111012 -[[r_revision_selection]]
@@ -11077,7 +11098,7 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr
1107711098
1107811099 However, you should be aware of how ridiculously unlikely this scenario is.
1107911100 The SHA-1 digest is 20 bytes or 160 bits.
11080-@@ -38,117 +78,326 @@
11101+@@ -38,120 +78,326 @@
1108111102 (the formula for determining collision probability is `p = (n(n-1)/2) * (1/2^160))`. 2^80^
1108211103 is 1.2 x 10^24^
1108311104 or 1 million billion billion.
@@ -11087,10 +11108,12 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr
1108711108 -Here’s an example to give you an idea of what it would take to get a SHA-1 collision.
1108811109 -If all 6.5 billion humans on Earth were programming, and every second, each one was producing code that was the equivalent of the entire Linux kernel history (3.6 million Git objects) and pushing it into one enormous Git repository, it would take roughly 2 years until that repository contained enough objects to have a 50% probability of a single SHA-1 object collision.
1108911110 -A higher probability exists that every member of your programming team will be attacked and killed by wolves in unrelated incidents on the same night.
11111+-====
1109011112 +Here's an example to give you an idea of what it would take to get a SHA-1 collision.
1109111113 +If all 6.5 billion humans on Earth were programming, and every second, each one was producing code that was the equivalent of the entire Linux kernel history (6.5 million Git objects) and pushing it into one enormous Git repository, it would take roughly 2 years until that repository contained enough objects to have a 50% probability of a single SHA-1 object collision.
1109211114 +Thus, an organic SHA-1 collision is less likely than every member of your programming team being attacked and killed by wolves in unrelated incidents on the same night.
11093-+
11115+
11116+-====
1109411117 +If you dedicate several thousands of dollars' worth of computing power to it, it is possible to synthesize two files with the same hash, as proven on https://shattered.io/[] in February 2017.
1109511118 +Git is moving towards using SHA256 as the default hashing algorithm, which is much more resilient to collision attacks, and has code in place to help mitigate this attack (although it cannot completely eliminate it).
1109611119 ====
@@ -11157,14 +11180,14 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr
1115711180 You can also use this syntax to see where a branch was some specific amount of time ago.
1115811181 -For instance, to see where your `master` branch was yesterday, you can type
1115911182 +For instance, to see where your `master` branch was yesterday, you can type:
11160-+
11183+
11184+-That shows you where the branch tip was yesterday.
11185+-This technique only works for data that’s still in your reflog, so you can’t use it to look for commits older than a few months.
1116111186 +[source,console]
1116211187 +----
1116311188 +$ git show master@{yesterday}
1116411189 +----
11165-
11166--That shows you where the branch tip was yesterday.
11167--This technique only works for data that’s still in your reflog, so you can’t use it to look for commits older than a few months.
11190++
1116811191 +That would show you where tip of your `master` branch was yesterday.
1116911192 +This technique only works for data that's still in your reflog, so you can't use it to look for commits older than a few months.
1117011193
@@ -11251,7 +11274,8 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr
1125111274 +Merge: 1c002dd... 35cfb2b...
1125211275 +Author: Scott Chacon <schacon@gmail.com>
1125311276 +Date: Thu Dec 11 15:08:43 2008 -0800
11254-+
11277+
11278+-The other main ancestry specification is the `~`.
1125511279 + Merge commit 'phedders/rdocs'
1125611280 +----
1125711281 +
@@ -11290,8 +11314,7 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr
1129011314 +
1129111315 + Some rdoc changes
1129211316 +----
11293-
11294--The other main ancestry specification is the `~`.
11317++
1129511318 +The other main ancestry specification is the `~` (tilde).
1129611319 This also refers to the first parent, so `HEAD~` and `HEAD^` are equivalent.
1129711320 The difference becomes apparent when you specify a number.
@@ -11456,7 +11479,7 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr
1145611479
1145711480 With these tools, you can much more easily let Git know what commit or commits you want to inspect.
1145811481 diff -au /tmp/book/07-git-tools/sections/rewriting-history.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/rewriting-history.asc
11459---- /tmp/book/07-git-tools/sections/rewriting-history.asc.tmp 2020-10-25 11:05:02.375646820 +0900
11482+--- /tmp/book/07-git-tools/sections/rewriting-history.asc.tmp 2020-10-25 13:21:06.989945302 +0900
1146011483 +++ ../../git/progit2/progit2/book/07-git-tools/sections/rewriting-history.asc 2020-09-12 09:27:13.222663694 +0900
1146111484 @@ -1,114 +1,346 @@
1146211485 -[[r_rewriting_history]]
@@ -11895,9 +11918,9 @@ diff -au /tmp/book/07-git-tools/sections/rewriting-history.asc.tmp ../../git/pro
1189511918 This goes through and rewrites every commit to have your new address.
1189611919 Because commits contain the SHA-1 values of their parents, this command changes every commit SHA-1 in your history, not just those that have the matching email address.
1189711920 diff -au /tmp/book/07-git-tools/sections/searching.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/searching.asc
11898---- /tmp/book/07-git-tools/sections/searching.asc.tmp 2020-10-25 11:05:02.381647157 +0900
11921+--- /tmp/book/07-git-tools/sections/searching.asc.tmp 2020-10-25 13:21:06.994945568 +0900
1189911922 +++ ../../git/progit2/progit2/book/07-git-tools/sections/searching.asc 2020-06-28 16:44:50.941017708 +0900
11900-@@ -1,28 +1,91 @@
11923+@@ -1,30 +1,91 @@
1190111924 -[[r_searching]]
1190211925 +[[_searching]]
1190311926 === Searching
@@ -11907,20 +11930,21 @@ diff -au /tmp/book/07-git-tools/sections/searching.asc.tmp ../../git/progit2/pro
1190711930 Git provides a couple of useful tools for looking through the code and commits stored in its database quickly and easily.
1190811931 We'll go through a few of them.
1190911932
11910--Git ships with a command called `grep` that allows you to easily search through any committed tree or the working directory for a string or regular expression.
11911--For these examples, we'll look through the Git source code itself.
1191211933 +[[_git_grep]]
11913-+==== Git Grep
11934+ ==== Git Grep
1191411935
11915--By default, it will look through the files in your working directory.
11916--You can pass `-n` to print out the line numbers where Git has found matches.
11936+-Git ships with a command called `grep` that allows you to easily search through any committed tree or the working directory for a string or regular expression.
11937+-For these examples, we'll look through the Git source code itself.
1191711938 +Git ships with a command called `grep` that allows you to easily search through any committed tree, the working directory, or even the index for a string or regular expression.
1191811939 +For the examples that follow, we'll search through the source code for Git itself.
1191911940
11920--There are a number of interesting options you can provide the `grep` command.
11941+-By default, it will look through the files in your working directory.
11942+-You can pass `-n` to print out the line numbers where Git has found matches.
1192111943 +By default, `git grep` will look through the files in your working directory.
1192211944 +As a first variation, you can use either of the `-n` or `--line-number` options to print out the line numbers where Git has found matches:
1192311945
11946+-There are a number of interesting options you can provide the `grep` command.
11947+-
1192411948 -For instance, instead of the previous call, you can have Git summarize the output by just showing you which files matched and how many matches there were in each file with the `--count` option:
1192511949 -
1192611950 -If you want to see what method or function it thinks it has found a match in, you can pass `-p`:
@@ -12006,7 +12030,7 @@ diff -au /tmp/book/07-git-tools/sections/searching.asc.tmp ../../git/progit2/pro
1200612030
1200712031 The `git grep` command has a few advantages over normal searching commands like `grep` and `ack`.
1200812032 The first is that it's really fast, the second is that you can search through any tree in Git, not just the working directory.
12009-@@ -30,24 +93,68 @@
12033+@@ -32,24 +93,68 @@
1201012034
1201112035 ==== Git Log Searching
1201212036
@@ -12083,7 +12107,7 @@ diff -au /tmp/book/07-git-tools/sections/searching.asc.tmp ../../git/progit2/pro
1208312107 +For example, this would have done the same thing as the example above: `git log -L '/unsigned long git_deflate_bound/',/^}/:zlib.c`.
1208412108 You could also give it a range of lines or a single line number and you'll get the same sort of output.
1208512109 diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/signing.asc
12086---- /tmp/book/07-git-tools/sections/signing.asc.tmp 2020-10-25 11:05:02.386647439 +0900
12110+--- /tmp/book/07-git-tools/sections/signing.asc.tmp 2020-10-25 13:21:07.002945994 +0900
1208712111 +++ ../../git/progit2/progit2/book/07-git-tools/sections/signing.asc 2020-06-28 16:44:50.941017708 +0900
1208812112 @@ -1,4 +1,4 @@
1208912113 -[[r_signing]]
@@ -12122,7 +12146,7 @@ diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progi
1212212146 Now Git will use your key by default to sign tags and commits if you want.
1212312147
1212412148 ==== Signing Tags
12125-@@ -19,36 +39,163 @@
12149+@@ -19,37 +39,163 @@
1212612150 If you have a GPG private key setup, you can now use it to sign new tags.
1212712151 All you have to do is use `-s` instead of `-a`:
1212812152
@@ -12154,7 +12178,7 @@ diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progi
1215412178 +ecorc4iXzQu7tupRihslbNkfvfciMnSDeSvzCpWAHl7h8Wj6hhqePmLm9lAYqnKp
1215512179 +8S5B/1SSQuEAjRZgI4IexpZoeKGVDptPHxLLS38fozsyi0QyDyzEgJxcJQVMXxVi
1215612180 +RUysgqjcpT8+iQM1PblGfHR4XAhuOqN5Fx06PSaFZhqvWFezJ28/CLyX5q+oIVk=
12157-+=EFTF
12181+ =EFTF
1215812182 +-----END PGP SIGNATURE-----
1215912183 +
1216012184 +commit ca82a6dff817ec66f44342007202690a93763949
@@ -12292,7 +12316,7 @@ diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progi
1229212316
1229312317 Signing tags and commits is great, but if you decide to use this in your normal workflow, you'll have to make sure that everyone on your team understands how to do so.
1229412318 diff -au /tmp/book/07-git-tools/sections/stashing-cleaning.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/stashing-cleaning.asc
12295---- /tmp/book/07-git-tools/sections/stashing-cleaning.asc.tmp 2020-10-25 11:05:02.392647776 +0900
12319+--- /tmp/book/07-git-tools/sections/stashing-cleaning.asc.tmp 2020-10-25 13:21:07.011946473 +0900
1229612320 +++ ../../git/progit2/progit2/book/07-git-tools/sections/stashing-cleaning.asc 2020-06-28 16:44:50.941017708 +0900
1229712321 @@ -1,72 +1,234 @@
1229812322 -[[r_git_stashing]]
@@ -12621,7 +12645,7 @@ diff -au /tmp/book/07-git-tools/sections/stashing-cleaning.asc.tmp ../../git/pro
1262112645 +In cases like that, you need to add a second `-f` option for emphasis.
1262212646 +====
1262312647 diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/submodules.asc
12624---- /tmp/book/07-git-tools/sections/submodules.asc.tmp 2020-10-25 11:05:02.400648226 +0900
12648+--- /tmp/book/07-git-tools/sections/submodules.asc.tmp 2020-10-25 13:21:07.024947164 +0900
1262512649 +++ ../../git/progit2/progit2/book/07-git-tools/sections/submodules.asc 2020-07-21 09:34:56.067548780 +0900
1262612650 @@ -1,21 +1,22 @@
1262712651 -[[r_git_submodules]]
@@ -12653,7 +12677,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1265312677 ==== Starting with Submodules
1265412678
1265512679 We'll walk through developing a simple project that has been split up into a main project and a few sub-projects.
12656-@@ -24,86 +25,432 @@
12680+@@ -24,89 +25,432 @@
1265712681 To add a new submodule you use the `git submodule add` command with the absolute or relative URL of the project you would like to start tracking.
1265812682 In this example, we'll add a library called ``DbConnector''.
1265912683
@@ -12706,12 +12730,13 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1270612730 This is how other people who clone this project know where to get the submodule projects from.
1270712731
1270812732 +[NOTE]
12709-+=====
12733+ =====
1271012734 Since the URL in the .gitmodules file is what other people will first try to clone/fetch from, make sure to use a URL that they can access if possible.
1271112735 For example, if you use a different URL to push to than others would to pull from, use the one that others have access to.
1271212736 You can overwrite this value locally with `git config submodule.DbConnector.url PRIVATE_URL` for your own use.
1271312737 When applicable, a relative URL can be helpful.
12714-+=====
12738+-
12739+ =====
1271512740
1271612741 The other listing in the `git status` output is the project folder entry.
1271712742 If you run `git diff` on that, you see something interesting:
@@ -12765,12 +12790,12 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1276512790 +That is a special mode in Git that basically means you're recording a commit as a directory entry rather than a subdirectory or a file.
1276612791 +
1276712792 +Lastly, push these changes:
12768-
12793++
1276912794 +[source,console]
1277012795 +----
1277112796 +$ git push origin master
1277212797 +----
12773-+
12798+
1277412799 +[[_cloning_submodules]]
1277512800 ==== Cloning a Project with Submodules
1277612801
@@ -13096,7 +13121,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1309613121
1309713122 ===== Working on a Submodule
1309813123
13099-@@ -113,53 +460,181 @@
13124+@@ -116,53 +460,181 @@
1310013125 So now let's go through an example of making changes to the submodule at the same time as the main project and committing and publishing those changes at the same time.
1310113126
1310213127 So far, when we've run the `git submodule update` command to fetch changes from the submodule repositories, Git would get the changes and update the files in the subdirectory but will leave the sub-repository in what's called a ``detached HEAD'' state.
@@ -13283,7 +13308,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1328313308
1328413309 ===== Merging Submodule Changes
1328513310
13286-@@ -171,6 +646,22 @@
13311+@@ -174,6 +646,22 @@
1328713312 Git will not attempt even a trivial merge for you, however.
1328813313 If the submodule commits diverge and need to be merged, you will get something that looks like this:
1328913314
@@ -13306,7 +13331,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1330613331 So basically what has happened here is that Git has figured out that the two branches record points in the submodule's history that are divergent and need to be merged.
1330713332 It explains it as ``merge following commits not found'', which is confusing but we'll explain why that is in a bit.
1330813333
13309-@@ -179,6 +670,15 @@
13334+@@ -182,6 +670,15 @@
1331013335 Fortunately, it's simple to figure out.
1331113336 If you run `git diff` you can get the SHA-1s of the commits recorded in both branches you were trying to merge.
1331213337
@@ -13322,7 +13347,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1332213347 So, in this case, `eb41d76` is the commit in our submodule that *we* had and `c771610` is the commit that upstream had.
1332313348 If we go into our submodule directory, it should already be on `eb41d76` as the merge would not have touched it.
1332413349 If for whatever reason it's not, you can simply create and checkout a branch pointing to it.
13325-@@ -188,15 +688,55 @@
13350+@@ -191,15 +688,55 @@
1332613351 You can either just try the merge with the SHA-1 directly, or you can create a branch for it and then try to merge that in.
1332713352 We would suggest the latter, even if only to make a nicer merge commit message.
1332813353
@@ -13384,7 +13409,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1338413409
1338513410 It can be a bit confusing, but it's really not very hard.
1338613411
13387-@@ -209,7 +749,38 @@
13412+@@ -212,7 +749,38 @@
1338813413
1338913414 If it does find a single acceptable merge commit, you'll see something like this:
1339013415
@@ -13424,15 +13449,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1342413449
1342513450 This accomplishes the same thing, but at least this way you can verify that it works and you have the code in your submodule directory when you're done.
1342613451
13427-@@ -217,52 +788,248 @@
13428-
13429- There are a few things you can do to make working with submodules a little easier.
13430-
13431-+===== Submodule Foreach
13432-+
13433- There is a `foreach` submodule command to run some arbitrary command in each submodule.
13434- This can be really helpful if you have a number of submodules in the same project.
13435-
13452+@@ -228,46 +796,240 @@
1343613453 For example, let's say we want to start a new feature or do a bugfix and we have work going on in several submodules.
1343713454 We can easily stash all the work in all our submodules.
1343813455
@@ -13678,7 +13695,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr
1367813695 You may need to go into your submodule directory and run a `git checkout .` to get all your files back.
1367913696 You could run this in a `submodule foreach` script to run it for multiple submodules.
1368013697 diff -au /tmp/book/07-git-tools/sections/subtree-merges.asc.tmp ../../git/progit2/progit2/book/07-git-tools/sections/subtree-merges.asc
13681---- /tmp/book/07-git-tools/sections/subtree-merges.asc.tmp 2020-10-25 11:05:02.406648564 +0900
13698+--- /tmp/book/07-git-tools/sections/subtree-merges.asc.tmp 2020-10-25 13:21:07.032947590 +0900
1368213699 +++ ../../git/progit2/progit2/book/07-git-tools/sections/subtree-merges.asc 2020-07-04 16:36:46.737685622 +0900
1368313700 @@ -1,4 +1,4 @@
1368413701 -[[r_subtree_merge]]
@@ -13789,7 +13806,7 @@ diff -au /tmp/book/07-git-tools/sections/subtree-merges.asc.tmp ../../git/progit
1378913806 +$ git diff-tree -p rack_remote/master
1379013807 +----
1379113808 diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/progit2/progit2/book/08-customizing-git/sections/attributes.asc
13792---- /tmp/book/08-customizing-git/sections/attributes.asc.tmp 2020-10-25 11:05:02.411648845 +0900
13809+--- /tmp/book/08-customizing-git/sections/attributes.asc.tmp 2020-10-25 13:21:07.043948175 +0900
1379313810 +++ ../../git/progit2/progit2/book/08-customizing-git/sections/attributes.asc 2020-07-04 16:36:46.738685634 +0900
1379413811 @@ -1,5 +1,6 @@
1379513812 === Git Attributes
@@ -14015,7 +14032,7 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog
1401514032 In this case, when you commit files that match `*.c`, Git will run them through the indent program before it stages them and then run them through the `cat` program before it checks them back out onto disk.
1401614033 The `cat` program does essentially nothing: it spits out the same data that it comes in.
1401714034 This combination effectively filters all C source code files through `indent` before committing.
14018-@@ -115,45 +228,125 @@
14035+@@ -115,22 +228,57 @@
1401914036 To do this properly, you need a small script that takes a filename, figures out the last commit date for this project, and inserts the date into the file.
1402014037 Here is a small Ruby script that does that:
1402114038
@@ -14072,11 +14089,8 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog
1407214089 +(((archiving)))
1407314090 Git attribute data also allows you to do some interesting things when exporting an archive of your project.
1407414091
14075-+===== `export-ignore`
14076-+
14077- You can tell Git not to export certain files or directories when generating an archive.
14078- If there is a subdirectory or file that you don't want to include in your archive file but that you do want checked into your project, you can determine those files via the `export-ignore` attribute.
14079-
14092+ ===== `export-ignore`
14093+@@ -141,23 +289,64 @@
1408014094 For example, say you have some test files in a `test/` subdirectory, and it doesn't make sense to include them in the tarball export of your project.
1408114095 You can add the following line to your Git attributes file:
1408214096
@@ -14085,13 +14099,13 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog
1408514099 +----
1408614100 +test/ export-ignore
1408714101 +----
14102++
14103++Now, when you run `git archive` to create a tarball of your project, that directory won't be included in the archive.
14104+
14105+ ===== `export-subst`
1408814106
1408914107 -When exporting files for deployment you can apply `git log`'s formatting and keyword-expansion processing to selected portions of files marked with the
1409014108 -`export-subst` attribute.
14091-+Now, when you run `git archive` to create a tarball of your project, that directory won't be included in the archive.
14092-+
14093-+===== `export-subst`
14094-+
1409514109 +When exporting files for deployment you can apply `git log`'s formatting and keyword-expansion processing to selected portions of files marked with the `export-subst` attribute.
1409614110
1409714111 For instance, if you want to include a file named `LAST_COMMIT` in your project, and have metadata about the last commit automatically injected into it when `git archive` runs, you can for example set up your `.gitattributes` and `LAST_COMMIT` files like this:
@@ -14145,7 +14159,7 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog
1414514159 You can also use Git attributes to tell Git to use different merge strategies for specific files in your project.
1414614160 One very useful option is to tell Git to not try to merge specific files when they have conflicts, but rather to use your side of the merge over someone else's.
1414714161
14148-@@ -161,8 +354,25 @@
14162+@@ -165,8 +354,25 @@
1414914163 Say you have a database settings file called `database.xml` that is different in two branches, and you want to merge in your other branch without messing up the database file.
1415014164 You can set up an attribute like this:
1415114165
@@ -14172,9 +14186,9 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog
1417214186 +
1417314187 In this case, `database.xml` stays at whatever version you originally had.
1417414188 diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/progit2/book/08-customizing-git/sections/config.asc
14175---- /tmp/book/08-customizing-git/sections/config.asc.tmp 2020-10-25 11:05:02.417649182 +0900
14189+--- /tmp/book/08-customizing-git/sections/config.asc.tmp 2020-10-25 13:21:07.057948919 +0900
1417614190 +++ ../../git/progit2/progit2/book/08-customizing-git/sections/config.asc 2020-08-10 10:02:15.170231399 +0900
14177-@@ -1,187 +1,466 @@
14191+@@ -1,97 +1,202 @@
1417814192 -[[r_git_config]]
1417914193 +[[_git_config]]
1418014194 === Git Configuration
@@ -14209,10 +14223,11 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1420914223 +Each of these ``levels'' (system, global, local) overwrites values in the previous level, so values in `.git/config` trump those in `[path]/etc/gitconfig`, for instance.
1421014224
1421114225 +[NOTE]
14212-+====
14226+ ====
1421314227 Git's configuration files are plain-text, so you can also set these values by manually editing the file and inserting the correct syntax.
1421414228 It's generally easier to run the `git config` command, though.
14215-+====
14229+-
14230+ ====
1421614231
1421714232 ==== Basic Client Configuration
1421814233
@@ -14233,8 +14248,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1423314248 This command lists all the available options in quite a bit of detail.
1423414249 -You can also find this reference material at http://git-scm.com/docs/git-config.html[].
1423514250 +You can also find this reference material at https://git-scm.com/docs/git-config[].
14236-+
14237-+===== `core.editor`
14251+
14252+ ===== `core.editor`
1423814253
1423914254 -By default, Git uses whatever you've set as your default text editor (`$VISUAL` or `$EDITOR`) or else falls back to the `vi` editor to create and edit your commit and tag messages.
1424014255 +((($EDITOR)))((($VISUAL, see $EDITOR)))
@@ -14248,10 +14263,10 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1424814263 +
1424914264 Now, no matter what is set as your default shell editor, Git will fire up Emacs to edit messages.
1425014265
14266+ ===== `commit.template`
14267+
1425114268 -If you set this to the path of a file on your system, Git will use that file as the default message when you commit.
1425214269 -For instance, suppose you create a template file at `~/.gitmessage.txt` that looks like this:
14253-+===== `commit.template`
14254-+
1425514270 +(((commit templates)))
1425614271 +If you set this to the path of a file on your system, Git will use that file as the default initial message when you commit.
1425714272 +The value in creating a custom commit template is that you can use it to remind yourself (or others) of the proper format and style when creating a commit message.
@@ -14303,8 +14318,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1430314318 +
1430414319 If your team has a commit-message policy, then putting a template for that policy on your system and configuring Git to use it by default can help increase the chance of that policy being followed regularly.
1430514320
14306-+===== `core.pager`
14307-+
14321+ ===== `core.pager`
14322+
1430814323 +(((pager)))
1430914324 This setting determines which pager is used when Git pages output such as `log` and `diff`.
1431014325 You can set it to `more` or to your favorite pager (by default, it's `less`), or you can turn it off by setting it to a blank string:
@@ -14316,9 +14331,9 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1431614331 +
1431714332 If you run that, Git will page the entire output of all commands, no matter how long they are.
1431814333
14334+ ===== `user.signingkey`
14335+
1431914336 -If you're making signed annotated tags (as discussed in <<ch07-git-tools#r_signing>>), setting your GPG signing key as a configuration setting makes things easier.
14320-+===== `user.signingkey`
14321-+
1432214337 +(((GPG)))
1432314338 +If you're making signed annotated tags (as discussed in <<ch07-git-tools#_signing>>), setting your GPG signing key as a configuration setting makes things easier.
1432414339 Set your key ID like so:
@@ -14330,14 +14345,14 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1433014345 +
1433114346 Now, you can sign tags without having to specify your key every time with the `git tag` command:
1433214347
14333--You can put patterns in your project's `.gitignore` file to have Git not see them as untracked files or try to stage them when you run `git add` on them, as discussed in <<ch02-git-basics#r_ignoring>>.
1433414348 +[source,console]
1433514349 +----
1433614350 +$ git tag -s <tag-name>
1433714351 +----
1433814352 +
14339-+===== `core.excludesfile`
14340-+
14353+ ===== `core.excludesfile`
14354+
14355+-You can put patterns in your project's `.gitignore` file to have Git not see them as untracked files or try to stage them when you run `git add` on them, as discussed in <<ch02-git-basics#r_ignoring>>.
1434114356 +(((excludes)))(((.gitignore)))
1434214357 +You can put patterns in your project's `.gitignore` file to have Git not see them as untracked files or try to stage them when you run `git add` on them, as discussed in <<ch02-git-basics-chapter#_ignoring>>.
1434314358
@@ -14359,8 +14374,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1435914374 +
1436014375 …and you run `git config --global core.excludesfile ~/.gitignore_global`, Git will never again bother you about those files.
1436114376
14362-+===== `help.autocorrect`
14363-+
14377+ ===== `help.autocorrect`
14378+
1436414379 +(((autocorrect)))
1436514380 If you mistype a command, it shows you something like this:
1436614381
@@ -14395,8 +14410,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1439514410 Git fully supports colored terminal output, which greatly aids in visually parsing command output quickly and easily.
1439614411 A number of options can help you set the coloring to your preference.
1439714412
14398-+===== `color.ui`
14399-+
14413+@@ -100,6 +205,11 @@
1440014414 Git automatically colors most of its output, but there's a master switch if you don't like this behavior.
1440114415 To turn off all Git's colored terminal output, do this:
1440214416
@@ -14408,11 +14422,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1440814422 The default setting is `auto`, which colors output when it's going straight to a terminal, but omits the color-control codes when the output is redirected to a pipe or a file.
1440914423
1441014424 You can also set it to `always` to ignore the difference between terminals and pipes.
14411- You'll rarely want this; in most scenarios, if you want color codes in your redirected output, you can instead pass a `--color` flag to the Git command to force it to use color codes.
14412- The default setting is almost always what you'll want.
14413-
14414-+===== `color.*`
14415-+
14425+@@ -111,100 +221,246 @@
1441614426 If you want to be more specific about which commands are colored and how, Git provides verb-specific coloring settings.
1441714427 Each of these can be set to `true`, `false`, or `always`:
1441814428
@@ -14585,8 +14595,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1458514595 It's very easy for patches or other collaborated work to introduce subtle whitespace changes because editors silently introduce them, and if your files ever touch a Windows system, their line endings might be replaced.
1458614596 Git has a few configuration options to help with these issues.
1458714597
14588-+===== `core.autocrlf`
14589-+
14598+ ===== `core.autocrlf`
14599+
1459014600 +(((crlf)))(((line endings)))
1459114601 If you're programming on Windows and working with people who are not (or vice-versa), you'll probably run into line-ending issues at some point.
1459214602 -This is because Windows uses both a carriage-return character and a linefeed character for newlines in its files, whereas Mac and Linux systems use only the linefeed character.
@@ -14622,8 +14632,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1462214632 +$ git config --global core.autocrlf false
1462314633 +----
1462414634 +
14625-+===== `core.whitespace`
14626-+
14635+ ===== `core.whitespace`
14636+
1462714637 Git comes preset to detect and fix some whitespace issues.
1462814638 -It can look for six primary whitespace issues – three are enabled by default and can be turned off, and three are disabled by default but can be activated.
1462914639 +It can look for six primary whitespace issues -- three are enabled by default and can be turned off, and three are disabled by default but can be activated.
@@ -14671,13 +14681,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1467114681 These options apply to the `git rebase` command as well.
1467214682 If you've committed whitespace issues but haven't yet pushed upstream, you can run `git rebase --whitespace=fix` to have Git automatically fix whitespace issues as it's rewriting the patches.
1467314683
14674-@@ -189,23 +468,44 @@
14675-
14676- Not nearly as many configuration options are available for the server side of Git, but there are a few interesting ones you may want to take note of.
14677-
14678-+===== `receive.fsckObjects`
14679-+
14680- Git is capable of making sure every object received during a push still matches its SHA-1 checksum and points to valid objects.
14684+@@ -218,6 +474,11 @@
1468114685 However, it doesn't do this by default; it's a fairly expensive operation, and might slow down the operation, especially on large repositories or pushes.
1468214686 If you want Git to check object consistency on every push, you can force it to do so by setting `receive.fsckObjects` to true:
1468314687
@@ -14688,10 +14692,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1468814692 +
1468914693 Now, Git will check the integrity of your repository before each push is accepted to make sure faulty (or malicious) clients aren't introducing corrupt data.
1469014694
14691-+===== `receive.denyNonFastForwards`
14692-+
14693- If you rebase commits that you've already pushed and then try to push again, or otherwise try to push a commit to a remote branch that doesn't contain the commit that the remote branch currently points to, you'll be denied.
14694- This is generally good policy; but in the case of the rebase, you may determine that you know what you're doing and can force-update the remote branch with a `-f` flag to your push command.
14695+ ===== `receive.denyNonFastForwards`
14696+@@ -227,6 +488,11 @@
1469514697
1469614698 To tell Git to refuse force-pushes, set `receive.denyNonFastForwards`:
1469714699
@@ -14703,8 +14705,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1470314705 The other way you can do this is via server-side receive hooks, which we'll cover in a bit.
1470414706 That approach lets you do more complex things like deny non-fast-forwards to a certain subset of users.
1470514707
14706-+===== `receive.denyDeletes`
14707-+
14708+@@ -235,6 +501,11 @@
1470814709 One of the workarounds to the `denyNonFastForwards` policy is for the user to delete the branch and then push it back up with the new reference.
1470914710 To avoid this, set `receive.denyDeletes` to true:
1471014711
@@ -14719,7 +14720,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/
1471914720 -There are also more interesting ways to do this on a per-user basis via ACLs, as you'll learn in <<r_an_example_git_enforced_policy>>.
1472014721 +There are also more interesting ways to do this on a per-user basis via ACLs, as you'll learn in <<ch08-customizing-git#_an_example_git_enforced_policy>>.
1472114722 diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/progit2/book/08-customizing-git/sections/hooks.asc
14722---- /tmp/book/08-customizing-git/sections/hooks.asc.tmp 2020-10-25 11:05:02.424649576 +0900
14723+--- /tmp/book/08-customizing-git/sections/hooks.asc.tmp 2020-10-25 13:21:07.066949398 +0900
1472314724 +++ ../../git/progit2/progit2/book/08-customizing-git/sections/hooks.asc 2020-09-26 08:56:07.952296414 +0900
1472414725 @@ -1,6 +1,7 @@
1472514726 -[[r_git_hooks]]
@@ -14739,20 +14740,20 @@ diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/p
1473914740 If you want to use the bundled hook scripts, you'll have to rename them; their file names all end with `.sample`.
1474014741
1474114742 To enable a hook script, put a file in the `hooks` subdirectory of your .git directory that is named appropriately (without any extension) and is executable.
14742-@@ -23,8 +24,11 @@
14743+@@ -23,10 +24,10 @@
1474314744 There are a lot of client-side hooks.
1474414745 This section splits them into committing-workflow hooks, email-workflow scripts, and everything else.
1474514746
1474614747 +[NOTE]
14747-+====
14748+ ====
1474814749 It's important to note that client-side hooks are *not* copied when you clone a repository.
1474914750 -If your intent with these scripts is to enforce a policy, you'll probably want to do that on the server side; see the example in <<r_an_example_git_enforced_policy>>.
14751+-
1475014752 +If your intent with these scripts is to enforce a policy, you'll probably want to do that on the server side; see the example in <<ch08-customizing-git#_an_example_git_enforced_policy>>.
14751-+====
14753+ ====
1475214754
1475314755 ===== Committing-Workflow Hooks
14754-
14755-@@ -43,12 +47,13 @@
14756+@@ -46,12 +47,13 @@
1475614757
1475714758 The `commit-msg` hook takes one parameter, which again is the path to a temporary file that contains the commit message written by the developer.
1475814759 If this script exits non-zero, Git aborts the commit process, so you can use it to validate your project state or commit message before allowing a commit to go through.
@@ -14767,7 +14768,7 @@ diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/p
1476714768 ===== Email Workflow Hooks
1476814769
1476914770 You can set up three client-side hooks for an email-based workflow.
14770-@@ -69,6 +74,7 @@
14771+@@ -72,6 +74,7 @@
1477114772 You can use it to notify a group or the author of the patch you pulled in that you've done so.
1477214773 You can't stop the patching process with this script.
1477314774
@@ -14775,26 +14776,7 @@ diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/p
1477514776 ===== Other Client Hooks
1477614777
1477714778 The `pre-rebase` hook runs before you rebase anything and can halt the process by exiting non-zero.
14778-@@ -99,16 +105,27 @@
14779- These scripts run before and after pushes to the server.
14780- The pre hooks can exit non-zero at any time to reject the push as well as print an error message back to the client; you can set up a push policy that's as complex as you wish.
14781-
14782-+===== `pre-receive`
14783-+
14784- The first script to run when handling a push from a client is `pre-receive`.
14785- It takes a list of references that are being pushed from stdin; if it exits non-zero, none of them are accepted.
14786- You can use this hook to do things like make sure none of the updated references are non-fast-forwards, or to do access control for all the refs and files they're modifying with the push.
14787-
14788-+===== `update`
14789-+
14790- The `update` script is very similar to the `pre-receive` script, except that it's run once for each branch the pusher is trying to update.
14791- If the pusher is trying to push to multiple branches, `pre-receive` runs only once, whereas update runs once per branch they're pushing to.
14792- Instead of reading from stdin, this script takes three arguments: the name of the reference (branch), the SHA-1 that reference pointed to before the push, and the SHA-1 the user is trying to push.
14793- If the update script exits non-zero, only that reference is rejected; other references can still be updated.
14794-
14795-+===== `post-receive`
14796-+
14797- The `post-receive` hook runs after the entire process is completed and can be used to update other services or notify users.
14779+@@ -121,3 +124,8 @@
1479814780 It takes the same stdin data as the `pre-receive` hook.
1479914781 Examples include emailing a list, notifying a continuous integration server, or updating a ticket-tracking system – you can even parse the commit messages to see if any tickets need to be opened, modified, or closed.
1480014782 This script can't stop the push process, but the client doesn't disconnect until it has completed, so be careful if you try to do anything that may take a long time.
@@ -14804,7 +14786,7 @@ diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/p
1480414786 +If you're writing a script/hook that others will need to read, prefer the long versions of command-line flags; six months from now you'll thank us.
1480514787 +====
1480614788 diff -au /tmp/book/08-customizing-git/sections/policy.asc.tmp ../../git/progit2/progit2/book/08-customizing-git/sections/policy.asc
14807---- /tmp/book/08-customizing-git/sections/policy.asc.tmp 2020-10-25 11:05:02.429649857 +0900
14789+--- /tmp/book/08-customizing-git/sections/policy.asc.tmp 2020-10-25 13:21:07.075949877 +0900
1480814790 +++ ../../git/progit2/progit2/book/08-customizing-git/sections/policy.asc 2020-07-04 16:36:46.738685634 +0900
1480914791 @@ -1,6 +1,7 @@
1481014792 -[[r_an_example_git_enforced_policy]]
@@ -15215,7 +15197,7 @@ diff -au /tmp/book/08-customizing-git/sections/policy.asc.tmp ../../git/progit2/
1521515197 You're looking for any commit that is reachable from the last commit on the remote and that isn't reachable from any parent of any of the SHA-1s you're trying to push up – meaning it's a fast-forward.
1521615198 Warning: file not found: ../../git/progit2/progit2-ja/book/09-git-and-other-scms/sections/client-bzr.asc
1521715199 diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-hg.asc
15218---- /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp 2020-10-25 11:05:02.436650251 +0900
15200+--- /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp 2020-10-25 13:21:07.085950409 +0900
1521915201 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-hg.asc 2020-07-01 10:48:37.622009668 +0900
1522015202 @@ -1,5 +1,7 @@
1522115203 ==== Git and Mercurial
@@ -15225,12 +15207,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1522515207 The DVCS universe is larger than just Git.
1522615208 In fact, there are many other systems in this space, each with their own angle on how to do distributed version control correctly.
1522715209 Apart from Git, the most popular is Mercurial, and the two are very similar in many respects.
15228-@@ -8,22 +10,41 @@
15229- Since the way Git talks to server repositories is through remotes, it should come as no surprise that this bridge is implemented as a remote helper.
15230- The project's name is git-remote-hg, and it can be found at https://github.com/felipec/git-remote-hg[].
15231-
15232-+===== git-remote-hg
15233-+
15210+@@ -13,19 +15,36 @@
1523415211 First, you need to install git-remote-hg.
1523515212 This basically entails dropping its file somewhere in your path, like so:
1523615213
@@ -15269,7 +15246,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1526915246 ===== Getting Started
1527015247
1527115248 Now that we have a suitable ``server-side'' repository, we can go through a typical workflow.
15272-@@ -31,6 +52,15 @@
15249+@@ -33,6 +52,15 @@
1527315250
1527415251 As always with Git, first we clone:
1527515252
@@ -15285,7 +15262,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1528515262 You'll notice that working with a Mercurial repository uses the standard `git clone` command.
1528615263 That's because git-remote-hg is working at a fairly low level, using a similar mechanism to how Git's HTTP/S protocol is implemented (remote helpers).
1528715264 Since Git and Mercurial are both designed for every client to have a full copy of the repository history, this command makes a full clone, including all the project's history, and does it fairly quickly.
15288-@@ -39,6 +69,28 @@
15265+@@ -41,6 +69,28 @@
1528915266 It turns out some of these aren't actually there.
1529015267 Let's take a look at what's actually in the `.git` directory:
1529115268
@@ -15314,7 +15291,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1531415291 Git-remote-hg is trying to make things more idiomatically Git-esque, but under the hood it's managing the conceptual mapping between two slightly different systems.
1531515292 The `refs/hg` directory is where the actual remote refs are stored.
1531615293 For example, the `refs/hg/origin/branches/default` is a Git ref file that contains the SHA-1 starting with ``ac7955c'', which is the commit that `master` points to.
15317-@@ -47,6 +99,26 @@
15294+@@ -49,6 +99,26 @@
1531815295 The `notes/hg` file is the starting point for how git-remote-hg maps Git commit hashes to Mercurial changeset IDs.
1531915296 Let's explore a bit:
1532015297
@@ -15341,7 +15318,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1534115318 So `refs/notes/hg` points to a tree, which in the Git object database is a list of other objects with names.
1534215319 `git ls-tree` outputs the mode, type, object hash, and filename for items inside a tree.
1534315320 Once we dig down to one of the tree items, we find that inside it is a blob named ``ac9117f'' (the SHA-1 hash of the commit pointed to by `master`), with contents ``0a04b98'' (which is the ID of the Mercurial changeset at the tip of the `default` branch).
15344-@@ -58,6 +130,11 @@
15321+@@ -60,6 +130,11 @@
1534515322 Mercurial and Git use a very similar mechanism for this, but it's likely you don't want to actually commit a `.gitignore` file into a Mercurial repository.
1534615323 Fortunately, Git has a way to ignore files that's local to an on-disk repository, and the Mercurial format is compatible with Git, so you just have to copy it over:
1534715324
@@ -15353,7 +15330,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1535315330 The `.git/info/exclude` file acts just like a `.gitignore`, but isn't included in commits.
1535415331
1535515332 ===== Workflow
15356-@@ -65,19 +142,92 @@
15333+@@ -67,19 +142,92 @@
1535715334 Let's assume we've done some work and made some commits on the `master` branch, and you're ready to push it to the remote repository.
1535815335 Here's what our repository looks like right now:
1535915336
@@ -15446,7 +15423,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1544615423 The changeset numbered _2_ was made by Mercurial, and the changesets numbered _3_ and _4_ were made by git-remote-hg, by pushing commits made with Git.
1544715424
1544815425 ===== Branches and Bookmarks
15449-@@ -89,31 +239,158 @@
15426+@@ -91,31 +239,158 @@
1545015427 The branch that a changeset is made on is recorded _with the changeset_, which means it will always be in the repository history.
1545115428 Here's an example of a commit that was made on the `develop` branch:
1545215429
@@ -15606,7 +15583,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr
1560615583
1560715584 Git and Mercurial are similar enough that working across the boundary is fairly painless.
1560815585 diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-p4.asc
15609---- /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp 2020-10-25 11:05:02.444650701 +0900
15586+--- /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp 2020-10-25 13:21:07.096950994 +0900
1561015587 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-p4.asc 2020-07-04 16:36:46.740685658 +0900
1561115588 @@ -1,5 +1,7 @@
1561215589 ==== Git and Perforce
@@ -15616,18 +15593,18 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1561615593 Perforce is a very popular version-control system in corporate environments.
1561715594 It's been around since 1995, which makes it the oldest system covered in this chapter.
1561815595 As such, it's designed with the constraints of its day; it assumes you're always connected to a single central server, and only one version is kept on the local disk.
15619-@@ -9,6 +11,10 @@
15596+@@ -9,8 +11,10 @@
1562015597 The first one we'll cover is the ``Git Fusion'' bridge from the makers of Perforce, which lets you expose subtrees of your Perforce depot as read-write Git repositories.
1562115598 The second is git-p4, a client-side bridge that lets you use Git as a Perforce client, without requiring any reconfiguration of the Perforce server.
1562215599
1562315600 +[[_p4_git_fusion]]
15624-+===== Git Fusion
15625-+
15601+ ===== Git Fusion
15602+
1562615603 +(((Perforce, Git Fusion)))
1562715604 Perforce provides a product called Git Fusion (available at http://www.perforce.com/git-fusion[]), which synchronizes a Perforce server with Git repositories on the server side.
1562815605
1562915606 ====== Setting Up
15630-@@ -19,14 +25,21 @@
15607+@@ -21,14 +25,21 @@
1563115608 Upon first starting the machine, it asks you to customize the password for three Linux users (`root`, `perforce`, and `git`), and provide an instance name, which can be used to distinguish this installation from others on the same network.
1563215609 When that has all completed, you'll see this:
1563315610
@@ -15651,7 +15628,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1565115628 The first one will open a VI editor to customize the user, but you can accept the defaults by typing `:wq` and hitting enter.
1565215629 The second one will prompt you to enter a password twice.
1565315630 That's all we need to do with a shell prompt, so exit out of the session.
15654-@@ -35,8 +48,27 @@
15631+@@ -37,8 +48,27 @@
1565515632 The Git Fusion image comes with a certificate, but it's for a domain that won't match your virtual machine's IP address, so Git will reject the HTTPS connection.
1565615633 If this is going to be a permanent installation, consult the Perforce Git Fusion manual to install a different certificate; for our example purposes, this will suffice:
1565715634
@@ -15679,7 +15656,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1567915656 The virtual-machine image comes equipped with a sample project that you can clone.
1568015657 Here we're cloning over HTTPS, with the `john` user that we created above; Git asks for credentials for this connection, but the credential cache will allow us to skip this step for any subsequent requests.
1568115658
15682-@@ -46,21 +78,86 @@
15659+@@ -48,21 +78,86 @@
1568315660 This is actually fairly easy to do using your favorite Perforce client; just map the `//.git-fusion` directory on the Perforce server into your workspace.
1568415661 The file structure looks like this:
1568515662
@@ -15766,7 +15743,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1576615743 This way, if your normal workspace mapping includes changes in the structure of the directories, you can replicate that with a Git repository.
1576715744
1576815745 The last file we'll discuss is `users/p4gf_usermap`, which maps Perforce users to Git users, and which you may not even need.
15769-@@ -68,6 +165,14 @@
15746+@@ -70,6 +165,14 @@
1577015747 When converting the other way, the default is to look up the Perforce user with the email address stored in the Git commit's author field, and submit the changeset as that user (with permissions applying).
1577115748 In most cases, this behavior will do just fine, but consider the following mapping file:
1577215749
@@ -15781,7 +15758,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1578115758 Each line is of the format `<user> <email> "<full name>"`, and creates a single user mapping.
1578215759 The first two lines map two distinct email addresses to the same Perforce user account.
1578315760 This is useful if you've created Git commits under several different email addresses (or change email addresses), but want them to be mapped to the same Perforce user.
15784-@@ -83,6 +188,32 @@
15761+@@ -85,6 +188,32 @@
1578515762 Let's have a look at how it feels to work from the Git side.
1578615763 We'll assume we've mapped in the ``Jam'' project using a configuration file as shown above, which we can clone like this:
1578715764
@@ -15814,7 +15791,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1581415791 The first time you do this, it may take some time.
1581515792 What's happening is that Git Fusion is converting all the applicable changesets in the Perforce history into Git commits.
1581615793 This happens locally on the server, so it's relatively fast, but if you have a lot of history, it can still take some time.
15817-@@ -92,19 +223,73 @@
15794+@@ -94,19 +223,73 @@
1581815795 There are three branches, and Git has helpfully created a local `master` branch that tracks `origin/master`.
1581915796 Let's do a bit of work, and create a couple of new commits:
1582015797
@@ -15890,27 +15867,27 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1589015867
1589115868 If you've never seen this view before, it may seem confusing, but it shows the same concepts as a graphical viewer for Git history.
1589215869 We're looking at the history of the `README` file, so the directory tree at top left only shows that file as it surfaces in various branches.
15893-@@ -127,12 +312,19 @@
15870+@@ -129,16 +312,18 @@
1589415871
1589515872 If you can't convince the administrator of your server to set up Git Fusion, there is still a way to use these tools together.
1589615873
1589715874 +[[_git_p4_client]]
15898-+===== Git-p4
15899-+
15875+ ===== Git-p4
15876+
1590015877 +(((git commands, p4)))
1590115878 Git-p4 is a two-way bridge between Git and Perforce.
1590215879 It runs entirely inside your Git repository, so you won't need any kind of access to the Perforce server (other than user credentials, of course).
1590315880 Git-p4 isn't as flexible or complete a solution as Git Fusion, but it does allow you to do most of what you'd want to do without being invasive to the server environment.
1590415881
1590515882 +[NOTE]
15906-+======
15883+ ======
1590715884 You'll need the `p4` tool somewhere in your `PATH` to work with git-p4.
1590815885 As of this writing, it is freely available at http://www.perforce.com/downloads/Perforce/20-User[].
15909-+======
15886+-
15887+ ======
1591015888
1591115889 ====== Setting Up
15912-
15913-@@ -140,18 +332,44 @@
15890+@@ -147,18 +332,44 @@
1591415891
1591515892 In order to use the `p4` command-line client (which git-p4 depends on), you'll need to set a couple of environment variables:
1591615893
@@ -15955,7 +15932,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1595515932 No remotes exist in this repository at all.
1595615933 Git-p4 has created some refs to represent the state of the server, and they look like remote refs to `git log`, but they're not managed by Git itself, and you can't push to them.
1595715934
15958-@@ -160,13 +378,51 @@
15935+@@ -167,13 +378,51 @@
1595915936 Okay, let's do some work.
1596015937 Let's assume you've made some progress on a very important feature, and you're ready to show it to the rest of your team.
1596115938
@@ -16007,7 +15984,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1600715984 You can probably tell from the output, but `git p4 rebase` is a shortcut for `git p4 sync` followed by `git rebase p4/master`.
1600815985 It's a bit smarter than that, especially when working with multiple branches, but this is a good approximation.
1600915986
16010-@@ -174,50 +430,229 @@
15987+@@ -181,50 +430,229 @@
1601115988 The `git p4 submit` command will try to create a new Perforce revision for every Git commit between `p4/master` and `master`.
1601215989 Running it drops us into our favorite editor, and the contents of the file look something like this:
1601315990
@@ -16239,9 +16216,9 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr
1623916216
1624016217 If we now `git checkout -b dev p4/project/dev` and make some commits, git-p4 is smart enough to target the right branch when we do `git p4 submit`.
1624116218 diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-svn.asc
16242---- /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp 2020-10-25 11:05:02.451651094 +0900
16219+--- /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp 2020-10-25 13:21:07.104951419 +0900
1624316220 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-svn.asc 2020-07-04 16:36:46.740685658 +0900
16244-@@ -1,16 +1,20 @@
16221+@@ -1,10 +1,12 @@
1624516222 -[[r_git_svn]]
1624616223 +[[_git_svn]]
1624716224 ==== Git and Subversion
@@ -16255,15 +16232,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1625516232 One of Git's great features is a bidirectional bridge to Subversion called `git svn`.
1625616233 This tool allows you to use Git as a valid client to a Subversion server, so you can use all the local features of Git and then push to a Subversion server as if you were using Subversion locally.
1625716234 This means you can do local branching and merging, use the staging area, use rebasing and cherry-picking, and so on, while your collaborators continue to work in their dark and ancient ways.
16258- It's a good way to sneak Git into the corporate environment and help your fellow developers become more efficient while you lobby to get the infrastructure changed to support Git fully.
16259- The Subversion bridge is the gateway drug to the DVCS world.
16260-
16261-+===== `git svn`
16262-+
16263- The base command in Git for all the Subversion bridging commands is `git svn`.
16264- It takes quite a few commands, so we'll show the most common while going through a few simple workflows.
16265-
16266-@@ -24,18 +28,48 @@
16235+@@ -26,18 +28,48 @@
1626716236 ===== Setting Up
1626816237
1626916238 To demonstrate this functionality, you need a typical SVN repository that you have write access to.
@@ -16315,7 +16284,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1631516284
1631616285 Although this operation may take only a few minutes, if you try to copy the original repository to another remote repository instead of a local one, the process will take nearly an hour, even though there are fewer than 100 commits.
1631716286 Subversion has to clone one revision at a time and then push it back into another repository – it's ridiculously inefficient, but it's the only easy way to do this.
16318-@@ -46,9 +80,29 @@
16287+@@ -48,9 +80,29 @@
1631916288 You'll start with the `git svn clone` command, which imports an entire Subversion repository into a local Git repository.
1632016289 Remember that if you're importing from a real hosted Subversion repository, you should replace the `file:///tmp/test-svn` here with the URL of your Subversion repository:
1632116290
@@ -16346,7 +16315,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1634616315 For a project with hundreds or thousands of commits, this can literally take hours or even days to finish.
1634716316
1634816317 The `-T trunk -b branches -t tags` part tells Git that this Subversion repository follows the basic branching and tagging conventions.
16349-@@ -56,30 +110,101 @@
16318+@@ -58,30 +110,101 @@
1635016319 Because this is so common, you can replace this entire part with `-s`, which means standard layout and implies all those options.
1635116320 The following command is equivalent:
1635216321
@@ -16450,7 +16419,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1645016419 Notice that the SHA-1 checksum that originally started with `4af61fd` when you committed now begins with `95e0222`.
1645116420 If you want to push to both a Git server and a Subversion server, you have to push (`dcommit`) to the Subversion server first, because that action changes your commit data.
1645216421
16453-@@ -89,13 +214,75 @@
16422+@@ -91,13 +214,75 @@
1645416423 That change will be rejected until you merge in their work.
1645516424 In `git svn`, it looks like this:
1645616425
@@ -16526,7 +16495,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1652616495 This is important to remember, because the outcome is a project state that didn't exist on either of your computers when you pushed.
1652716496 If the changes are incompatible but don't conflict, you may get issues that are difficult to diagnose.
1652816497 This is different than using a Git server – in Git, you can fully test the state on your client system before publishing it, whereas in SVN, you can't ever be certain that the states immediately before commit and after commit are identical.
16529-@@ -103,6 +290,15 @@
16498+@@ -105,6 +290,15 @@
1653016499 You should also run this command to pull in changes from the Subversion server, even if you're not ready to commit yourself.
1653116500 You can run `git svn fetch` to grab the new data, but `git svn rebase` does the fetch and then updates your local commits.
1653216501
@@ -16542,7 +16511,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1654216511 Running `git svn rebase` every once in a while makes sure your code is always up to date.
1654316512 You need to be sure your working directory is clean when you run this, though.
1654416513 If you have local changes, you must either stash your work or temporarily commit it before running `git svn rebase` – otherwise, the command will stop if it sees that the rebase will result in a merge conflict.
16545-@@ -116,6 +312,24 @@
16514+@@ -118,6 +312,24 @@
1654616515 Suppose your history looks like the following: you created an `experiment` branch, did two commits, and then merged them back into `master`.
1654716516 When you `dcommit`, you see output like this:
1654816517
@@ -16567,7 +16536,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1656716536 Running `dcommit` on a branch with merged history works fine, except that when you look at your Git project history, it hasn't rewritten either of the commits you made on the `experiment` branch – instead, all those changes appear in the SVN version of the single merge commit.
1656816537
1656916538 When someone else clones that work, all they see is the merge commit with all the work squashed into it, as though you ran `git merge --squash`; they don't see the commit data about where it came from or when it was committed.
16570-@@ -123,11 +337,22 @@
16539+@@ -125,11 +337,22 @@
1657116540 ===== Subversion Branching
1657216541
1657316542 Branching in Subversion isn't the same as branching in Git; if you can avoid using it much, that's probably best.
@@ -16592,7 +16561,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1659216561
1659316562 This does the equivalent of the `svn copy trunk branches/opera` command in Subversion and operates on the Subversion server.
1659416563 It's important to note that it doesn't check you out into that branch; if you commit at this point, that commit will go to `trunk` on the server, not `opera`.
16595-@@ -137,7 +362,12 @@
16564+@@ -139,7 +362,12 @@
1659616565 Git figures out what branch your dcommits go to by looking for the tip of any of your Subversion branches in your history – you should have only one, and it should be the last one with a `git-svn-id` in your current branch history.
1659716566
1659816567 If you want to work on more than one branch simultaneously, you can set up local branches to `dcommit` to specific Subversion branches by starting them at the imported Subversion commit for that branch.
@@ -16606,7 +16575,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1660616575
1660716576 Now, if you want to merge your `opera` branch into `trunk` (your `master` branch), you can do so with a normal `git merge`.
1660816577 But you need to provide a descriptive commit message (via `-m`), or the merge will say ``Merge branch opera'' instead of something useful.
16609-@@ -145,7 +375,7 @@
16578+@@ -147,7 +375,7 @@
1661016579 Remember that although you're using `git merge` to do this operation, and the merge likely will be much easier than it would be in Subversion (because Git will automatically detect the appropriate merge base for you), this isn't a normal Git merge commit.
1661116580 You have to push this data back to a Subversion server that can't handle a commit that tracks more than one parent; so, after you push it up, it will look like a single commit that squashed in all the work of another branch under a single commit.
1661216581 After you merge one branch into another, you can't easily go back and continue working on that branch, as you normally can in Git.
@@ -16615,7 +16584,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1661516584 Unfortunately, there's no good way to avoid this situation – Subversion can't store this information, so you'll always be crippled by its limitations while you're using it as your server.
1661616585 To avoid issues, you should delete the local branch (in this case, `opera`) after you merge it into trunk.
1661716586
16618-@@ -158,6 +388,25 @@
16587+@@ -160,6 +388,25 @@
1661916588
1662016589 If you're used to Subversion and want to see your history in SVN output style, you can run `git svn log` to view your commit history in SVN formatting:
1662116590
@@ -16641,7 +16610,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1664116610 You should know two important things about `git svn log`.
1664216611 First, it works offline, unlike the real `svn log` command, which asks the Subversion server for the data.
1664316612 Second, it only shows you commits that have been committed up to the Subversion server.
16644-@@ -169,12 +418,44 @@
16613+@@ -171,12 +418,44 @@
1664516614 Much as the `git svn log` command simulates the `svn log` command offline, you can get the equivalent of `svn annotate` by running `git svn blame [FILE]`.
1664616615 The output looks like this:
1664716616
@@ -16686,7 +16655,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1668616655 This is like `blame` and `log` in that it runs offline and is up to date only as of the last time you communicated with the Subversion server.
1668716656
1668816657 ====== Ignoring What Subversion Ignores
16689-@@ -185,6 +466,11 @@
16658+@@ -187,6 +466,11 @@
1669016659
1669116660 The second command is `git svn show-ignore`, which prints to stdout the lines you need to put in a `.gitignore` file so you can redirect the output into your project exclude file:
1669216661
@@ -16700,7 +16669,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p
1670016669
1670116670 Warning: file not found: ../../git/progit2/progit2-ja/book/09-git-and-other-scms/sections/import-bzr.asc
1670216671 diff -au /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-custom.asc
16703---- /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp 2020-10-25 11:05:02.458651488 +0900
16672+--- /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp 2020-10-25 13:21:07.115952004 +0900
1670416673 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-custom.asc 2020-06-28 16:44:50.946018445 +0900
1670516674 @@ -1,4 +1,4 @@
1670616675 -[[r_custom_importer]]
@@ -16708,7 +16677,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp ../../gi
1670816677 ==== A Custom Importer
1670916678
1671016679 (((git commands, fast-import)))
16711-@@ -14,82 +14,359 @@
16680+@@ -14,85 +14,359 @@
1671216681 Suppose you work in `current`, you back up your project by occasionally copying the directory into a time-stamped `back_YYYY_MM_DD` backup directory, and you want to import this into Git.
1671316682 Your directory structure looks like this:
1671416683
@@ -16890,18 +16859,18 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp ../../gi
1689016859 +----
1689116860 +
1689216861 +[NOTE]
16893-+====
16862+ ====
1689416863 If you are running on Windows you'll need to make sure that you add one extra step.
1689516864 -As mentioned before, Windows uses CRLF for new line characters while git fast-import expects only LF.
1689616865 -To get around this problem and make git fast-import happy, you need to tell ruby to use LF instead of CRLF:
1689716866 +As mentioned before, Windows uses CRLF for new line characters while `git fast-import` expects only LF.
1689816867 +To get around this problem and make `git fast-import` happy, you need to tell ruby to use LF instead of CRLF:
16899-+
16868+
1690016869 +[source,ruby]
1690116870 +----
1690216871 +$stdout.binmode
1690316872 +----
16904-+====
16873+ ====
1690516874
1690616875 That's it.
1690716876 Here's the script in its entirety:
@@ -17073,7 +17042,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp ../../gi
1707317042 You can do a lot more with the `fast-import` tool – handle different modes, binary data, multiple branches and merging, tags, progress indicators, and more.
1707417043 A number of examples of more complex scenarios are available in the `contrib/fast-import` directory of the Git source code.
1707517044 diff -au /tmp/book/09-git-and-other-scms/sections/import-hg.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-hg.asc
17076---- /tmp/book/09-git-and-other-scms/sections/import-hg.asc.tmp 2020-10-25 11:05:02.463651769 +0900
17045+--- /tmp/book/09-git-and-other-scms/sections/import-hg.asc.tmp 2020-10-25 13:21:07.124952483 +0900
1707717046 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-hg.asc 2020-06-28 16:44:50.947018592 +0900
1707817047 @@ -3,25 +3,122 @@
1707917048 (((Mercurial)))(((Importing, from Mercurial)))
@@ -17201,19 +17170,17 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-hg.asc.tmp ../../git/pr
1720117170 +$ git push origin --all
1720217171 +----
1720317172 diff -au /tmp/book/09-git-and-other-scms/sections/import-p4.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-p4.asc
17204---- /tmp/book/09-git-and-other-scms/sections/import-p4.asc.tmp 2020-10-25 11:05:02.468652050 +0900
17173+--- /tmp/book/09-git-and-other-scms/sections/import-p4.asc.tmp 2020-10-25 13:21:07.136953121 +0900
1720517174 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-p4.asc 2020-06-28 16:44:50.947018592 +0900
17206-@@ -1,38 +1,102 @@
17175+@@ -1,4 +1,4 @@
1720717176 -[[r_perforce_import]]
1720817177 +[[_perforce_import]]
1720917178 ==== Perforce
1721017179
1721117180 (((Perforce)))(((Importing, from Perforce)))
17212- The next system you'll look at importing from is Perforce.
17213- As we discussed above, there are two ways to let Git and Perforce talk to each other: git-p4 and Perforce Git Fusion.
17181+@@ -8,38 +8,95 @@
17182+ ===== Perforce Git Fusion
1721417183
17215-+===== Perforce Git Fusion
17216-+
1721717184 Git Fusion makes this process fairly painless.
1721817185 -Just configure your project settings, user mappings, and branches using a configuration file (as discussed in <<r_p4_git_fusion>>), and clone the repository.
1721917186 +Just configure your project settings, user mappings, and branches using a configuration file (as discussed in <<_p4_git_fusion>>), and clone the repository.
@@ -17223,6 +17190,8 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-p4.asc.tmp ../../git/pr
1722317190 +[[_git_p4]]
1722417191 ===== Git-p4
1722517192
17193+-===== git-p4
17194+-
1722617195 Git-p4 can also act as an import tool.
1722717196 As an example, we'll import the Jam project from the Perforce Public Depot.
1722817197 To set up your client, you must export the P4PORT environment variable to point to the Perforce depot:
@@ -17233,10 +17202,11 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-p4.asc.tmp ../../git/pr
1723317202 +----
1723417203 +
1723517204 +[NOTE]
17236-+====
17205+ ====
1723717206 In order to follow along, you'll need a Perforce depot to connect with.
1723817207 We'll be using the public depot at public.perforce.com for our examples, but you can use any depot you have access to.
17239-+====
17208+-
17209+ ====
1724017210
1724117211 +(((git commands, p4)))
1724217212 Run the `git p4 clone` command to import the Jam project from the Perforce server, supplying the depot and project path and the path into which you want to import the project:
@@ -17310,7 +17280,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-p4.asc.tmp ../../git/pr
1731017280 +
1731117281 Your import is ready to push up to your new Git server.
1731217282 diff -au /tmp/book/09-git-and-other-scms/sections/import-svn.asc.tmp ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-svn.asc
17313---- /tmp/book/09-git-and-other-scms/sections/import-svn.asc.tmp 2020-10-25 11:05:02.473652332 +0900
17283+--- /tmp/book/09-git-and-other-scms/sections/import-svn.asc.tmp 2020-10-25 13:21:07.146953653 +0900
1731417284 +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-svn.asc 2020-07-04 16:36:46.743685694 +0900
1731517285 @@ -12,21 +12,76 @@
1731617286 If you want to map this to better Git author data, you need a mapping from the Subversion users to the Git authors.
@@ -17451,7 +17421,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-svn.asc.tmp ../../git/p
1745117421 +
1745217422 All your branches and tags should be on your new Git server in a nice, clean import.
1745317423 diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/environment.asc
17454---- /tmp/book/10-git-internals/sections/environment.asc.tmp 2020-10-25 11:05:02.479652669 +0900
17424+--- /tmp/book/10-git-internals/sections/environment.asc.tmp 2020-10-25 13:21:07.155954132 +0900
1745517425 +++ ../../git/progit2/progit2/book/10-git-internals/sections/environment.asc 2020-07-01 10:48:37.623009671 +0900
1745617426 @@ -4,6 +4,7 @@
1745717427 Occasionally, it comes in handy to know what these are, and how they can be used to make Git behave the way you want it to.
@@ -17478,12 +17448,14 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1747817448
1747917449 *`GIT_INDEX_FILE`* is the path to the index file (non-bare repositories only).
1748017450
17481-@@ -46,12 +48,13 @@
17451+@@ -46,14 +48,13 @@
1748217452 *`GIT_ALTERNATE_OBJECT_DIRECTORIES`* is a colon-separated list (formatted like `/dir/one:/dir/two:…`) which tells Git where to check for objects if they aren't in `GIT_OBJECT_DIRECTORY`.
1748317453 If you happen to have a lot of projects with large files that have the exact same contents, this can be used to avoid storing too many copies of them.
1748417454
17485-+
17486- ==== Pathspecs
17455+-==== Pathspecs
17456+
17457+-==== Pathspec
17458++==== Pathspecs
1748717459
1748817460 A ``pathspec'' refers to how you specify paths to things in Git, including the use of wildcards.
1748917461 These are used in the `.gitignore` file, but also on the command-line (`git add *.c`).
@@ -17493,7 +17465,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1749317465 If `GIT_GLOB_PATHSPECS` is set to 1, wildcard characters act as wildcards (which is the default); if `GIT_NOGLOB_PATHSPECS` is set to 1, wildcard characters only match themselves, meaning something like `*.c` would only match a file _named_ ``*.c'', rather than any file whose name ends with `.c`.
1749417466 You can override this in individual cases by starting the pathspec with `:(glob)` or `:(literal)`, as in `:(glob)*.c`.
1749517467
17496-@@ -59,6 +62,7 @@
17468+@@ -61,6 +62,7 @@
1749717469
1749817470 *`GIT_ICASE_PATHSPECS`* sets all pathspecs to work in a case-insensitive manner.
1749917471
@@ -17501,7 +17473,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1750117473 ==== Committing
1750217474
1750317475 The final creation of a Git commit object is usually done by `git-commit-tree`, which uses these environment variables as its primary source of information, falling back to configuration values only if these aren't present.
17504-@@ -78,6 +82,7 @@
17476+@@ -80,6 +82,7 @@
1750517477 *`EMAIL`* is the fallback email address in case the `user.email` configuration value isn't set.
1750617478 If _this_ isn't set, Git falls back to the system user and host names.
1750717479
@@ -17509,7 +17481,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1750917481 ==== Networking
1751017482
1751117483 Git uses the `curl` library to do network operations over HTTP, so *`GIT_CURL_VERBOSE`* tells Git to emit all the messages generated by that library.
17512-@@ -86,12 +91,14 @@
17484+@@ -88,12 +91,14 @@
1751317485 *`GIT_SSL_NO_VERIFY`* tells Git not to verify SSL certificates.
1751417486 This can sometimes be necessary if you're using a self-signed certificate to serve Git repositories over HTTPS, or you're in the middle of setting up a Git server but haven't installed a full certificate yet.
1751517487
@@ -17524,7 +17496,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1752417496 ==== Diffing and Merging
1752517497
1752617498 *`GIT_DIFF_OPTS`* is a bit of a misnomer.
17527-@@ -127,16 +134,84 @@
17499+@@ -129,16 +134,84 @@
1752817500 *`GIT_TRACE`* controls general traces, which don't fit into any specific category.
1752917501 This includes the expansion of aliases, and delegation to other sub-programs.
1753017502
@@ -17610,7 +17582,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1761017582 ==== Miscellaneous
1761117583
1761217584 *`GIT_SSH`*, if specified, is a program that is invoked instead of `ssh` when Git tries to connect to an SSH host.
17613-@@ -145,8 +220,7 @@
17585+@@ -147,8 +220,7 @@
1761417586 It's probably easier just to use the `~/.ssh/config` file for that.
1761517587
1761617588 *`GIT_ASKPASS`* is an override for the `core.askpass` configuration value.
@@ -17620,7 +17592,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1762017592
1762117593 *`GIT_NAMESPACE`* controls access to namespaced refs, and is equivalent to the `--namespace` flag.
1762217594 This is mostly useful on the server side, where you may want to store multiple forks of a single repository in one repository, only keeping the refs separate.
17623-@@ -157,3 +231,11 @@
17595+@@ -159,3 +231,11 @@
1762417596
1762517597 *`GIT_REFLOG_ACTION`* lets you specify the descriptive text written to the reflog.
1762617598 Here's an example:
@@ -17633,7 +17605,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi
1763317605 +9e3d55a HEAD@{0}: my action: My message
1763417606 +----
1763517607 diff -au /tmp/book/10-git-internals/sections/maintenance.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/maintenance.asc
17636---- /tmp/book/10-git-internals/sections/maintenance.asc.tmp 2020-10-25 11:05:02.485653007 +0900
17608+--- /tmp/book/10-git-internals/sections/maintenance.asc.tmp 2020-10-25 13:21:07.164954610 +0900
1763717609 +++ ../../git/progit2/progit2/book/10-git-internals/sections/maintenance.asc 2020-06-28 16:44:50.948018739 +0900
1763817610 @@ -3,6 +3,7 @@
1763917611 Occasionally, you may have to do some cleanup – make a repository more compact, clean up an imported repository, or recover lost work.
@@ -17972,9 +17944,9 @@ diff -au /tmp/book/10-git-internals/sections/maintenance.asc.tmp ../../git/progi
1797217944 +size-garbage: 0
1797317945 +----
1797417946 diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/objects.asc
17975---- /tmp/book/10-git-internals/sections/objects.asc.tmp 2020-10-25 11:05:02.492653400 +0900
17947+--- /tmp/book/10-git-internals/sections/objects.asc.tmp 2020-10-25 13:21:07.175955196 +0900
1797617948 +++ ../../git/progit2/progit2/book/10-git-internals/sections/objects.asc 2020-07-04 16:36:46.743685694 +0900
17977-@@ -1,148 +1,438 @@
17949+@@ -1,159 +1,438 @@
1797817950 -[[r_objects]]
1797917951 +[[_objects]]
1798017952 === Git Objects
@@ -18007,7 +17979,11 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1800717979 Git has initialized the `objects` directory and created `pack` and `info` subdirectories in it, but there are no regular files.
1800817980 -Now, store some text in your Git database:
1800917981 +Now, let's use `git hash-object` to create a new data object and manually store it in your new Git database:
18010-+
17982+
17983+-The `-w` tells `hash-object` to store the object; otherwise, the command simply tells you what the key would be.
17984+-`--stdin` tells the command to read the content from stdin; if you don't specify this, `hash-object` expects a file path at the end.
17985+-The output from the command is a 40-character checksum hash.
17986+-This is the SHA-1 hash – a checksum of the content you're storing plus a header, which you'll learn about in a bit.
1801117987 +[source,console]
1801217988 +----
1801317989 +$ echo 'test content' | git hash-object -w --stdin
@@ -18017,11 +17993,7 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1801717993 +In its simplest form, `git hash-object` would take the content you handed to it and merely return the unique key that _would_ be used to store it in your Git database.
1801817994 +The `-w` option then tells the command to not simply return the key, but to write that object to the database.
1801917995 +Finally, the `--stdin` option tells `git hash-object` to get the content to be processed from stdin; otherwise, the command would expect a filename argument at the end of the command containing the content to be used.
18020-
18021--The `-w` tells `hash-object` to store the object; otherwise, the command simply tells you what the key would be.
18022--`--stdin` tells the command to read the content from stdin; if you don't specify this, `hash-object` expects a file path at the end.
18023--The output from the command is a 40-character checksum hash.
18024--This is the SHA-1 hash – a checksum of the content you're storing plus a header, which you'll learn about in a bit.
17996++
1802517997 +The output from the above command is a 40-character checksum hash.
1802617998 +This is the SHA-1 hash -- a checksum of the content you're storing plus a header, which you'll learn about in a bit.
1802717999 Now you can see how Git has stored your data:
@@ -18285,11 +18257,11 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1828518257 +tree d8329fc1cc938780ffdd9f94e0d364e0ea74f579
1828618258 +author Scott Chacon <schacon@gmail.com> 1243040974 -0700
1828718259 +committer Scott Chacon <schacon@gmail.com> 1243040974 -0700
18288-+
18289-+First commit
18290-+----
1829118260
1829218261 -The format for a commit object is simple: it specifies the top-level tree for the snapshot of the project at that point; the author/committer information (which uses your `user.name` and `user.email` configuration settings and a timestamp); a blank line, and then the commit message.
18262++First commit
18263++----
18264++
1829318265 +The format for a commit object is simple: it specifies the top-level tree for the snapshot of the project at that point; the parent commits if any (the commit object described above does not have any parents); the author/committer information (which uses your `user.name` and `user.email` configuration settings and a timestamp); a blank line, and then the commit message.
1829418266
1829518267 Next, you'll write the other two commit objects, each referencing the commit that came directly before it:
@@ -18378,35 +18350,35 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1837818350
1837918351 You can start up interactive Ruby mode with the `irb` command:
1838018352
18381--Git constructs a header that starts with the type of the object, in this case a blob.
18382--Then, it adds a space followed by the size of the content and finally a null byte:
1838318353 +[source,console]
1838418354 +----
1838518355 +$ irb
1838618356 +>> content = "what is up, doc?"
18387-+=> "what is up, doc?"
18357+ => "what is up, doc?"
18358+-Git constructs a header that starts with the type of the object, in this case a blob.
18359+-Then, it adds a space followed by the size of the content and finally a null byte:
1838818360 +----
1838918361 +
1839018362 +Git first constructs a header which starts by identifying the type of object -- in this case, a blob.
1839118363 +To that first part of the header, Git adds a space followed by the size in bytes of the content, and adding a final null byte:
18392-+
18364+
1839318365 +[source,console]
1839418366 +----
1839518367 +>> header = "blob #{content.bytesize}\0"
18396-+=> "blob 16\u0000"
18368+ => "blob 16\u0000"
1839718369 +----
18398-
18370++
1839918371 Git concatenates the header and the original content and then calculates the SHA-1 checksum of that new content.
1840018372 You can calculate the SHA-1 value of a string in Ruby by including the SHA1 digest library with the `require` command and then calling `Digest::SHA1.hexdigest()` with the string:
1840118373
1840218374 +[source,console]
1840318375 +----
1840418376 +>> store = header + content
18405-+=> "blob 16\u0000what is up, doc?"
18377+ => "blob 16\u0000what is up, doc?"
1840618378 +>> require 'digest/sha1'
18407-+=> true
18379+ => true
1840818380 +>> sha1 = Digest::SHA1.hexdigest(store)
18409-+=> "bd9dbf5aae1a3862dd1526723246b20206e5fc37"
18381+ => "bd9dbf5aae1a3862dd1526723246b20206e5fc37"
1841018382 +----
1841118383 +
1841218384 +Let's compare that to the output of `git hash-object`.
@@ -18424,9 +18396,9 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1842418396 +[source,console]
1842518397 +----
1842618398 +>> require 'zlib'
18427-+=> true
18399+ => true
1842818400 +>> zlib_content = Zlib::Deflate.deflate(store)
18429-+=> "x\x9CK\xCA\xC9OR04c(\xCFH,Q\xC8,V(-\xD0QH\xC9O\xB6\a\x00_\x1C\a\x9D"
18401+ => "x\x9CK\xCA\xC9OR04c(\xCFH,Q\xC8,V(-\xD0QH\xC9O\xB6\a\x00_\x1C\a\x9D"
1843018402 +----
1843118403 +
1843218404 Finally, you'll write your zlib-deflated content to an object on disk.
@@ -18437,13 +18409,13 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1843718409 +[source,console]
1843818410 +----
1843918411 +>> path = '.git/objects/' + sha1[0,2] + '/' + sha1[2,38]
18440-+=> ".git/objects/bd/9dbf5aae1a3862dd1526723246b20206e5fc37"
18412+ => ".git/objects/bd/9dbf5aae1a3862dd1526723246b20206e5fc37"
1844118413 +>> require 'fileutils'
18442-+=> true
18414+ => true
1844318415 +>> FileUtils.mkdir_p(File.dirname(path))
18444-+=> ".git/objects/bd"
18416+ => ".git/objects/bd"
1844518417 +>> File.open(path, 'w') { |f| f.write zlib_content }
18446-+=> 32
18418+ => 32
1844718419 +----
1844818420 +
1844918421 +Let's check the content of the object using `git cat-file`:
@@ -18459,22 +18431,16 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p
1845918431 All Git objects are stored the same way, just with different types – instead of the string blob, the header will begin with commit or tree.
1846018432 Also, although the blob content can be nearly anything, the commit and tree content are very specifically formatted.
1846118433 diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/packfiles.asc
18462---- /tmp/book/10-git-internals/sections/packfiles.asc.tmp 2020-10-25 11:05:02.498653738 +0900
18434+--- /tmp/book/10-git-internals/sections/packfiles.asc.tmp 2020-10-25 13:21:07.184955674 +0900
1846318435 +++ ../../git/progit2/progit2/book/10-git-internals/sections/packfiles.asc 2020-06-28 16:44:50.948018739 +0900
18464-@@ -1,23 +1,87 @@
18436+@@ -1,25 +1,87 @@
1846518437 === Packfiles
1846618438
18467--Let's go back to the objects database for your test Git repository.
18468--At this point, you have 11 objects – 4 blobs, 3 trees, 3 commits, and 1 tag:
18439+-=== Packfile
1846918440 +If you followed all of the instructions in the example from the previous section, you should now have a test Git repository with 11 objects -- four blobs, three trees, three commits, and one tag:
1847018441
18471--Git compresses the contents of these files with zlib, and you're not storing much, so all these files collectively take up only 925 bytes.
18472--You'll add some larger content to the repository to demonstrate an interesting feature of Git.
18473--To demonstrate, we'll add the `repo.rb` file from the Grit library – this is about a 22K source code file:
18474--
18475--If you look at the resulting tree, you can see the SHA-1 value your repo.rb file got for the blob object:
18476--
18477--You can then use `git cat-file` to see how big that object is:
18442+-Let's go back to the objects database for your test Git repository.
18443+-At this point, you have 11 objects – 4 blobs, 3 trees, 3 commits, and 1 tag:
1847818444 +[source,console]
1847918445 +----
1848018446 +$ find .git/objects -type f
@@ -18491,11 +18457,18 @@ diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2
1849118457 +.git/objects/fd/f4fc3344e67ab068f836878b6c4951e3b15f3d # commit 1
1849218458 +----
1849318459
18494--Now, modify that file a little, and see what happens:
18495-+Git compresses the contents of these files with zlib, and you're not storing much, so all these files collectively take up only 925 bytes.
18460+ Git compresses the contents of these files with zlib, and you're not storing much, so all these files collectively take up only 925 bytes.
18461+-You'll add some larger content to the repository to demonstrate an interesting feature of Git.
18462+-To demonstrate, we'll add the `repo.rb` file from the Grit library – this is about a 22K source code file:
1849618463 +Now you'll add some more sizable content to the repository to demonstrate an interesting feature of Git.
1849718464 +To demonstrate, we'll add the `repo.rb` file from the Grit library -- this is about a 22K source code file:
1849818465
18466+-If you look at the resulting tree, you can see the SHA-1 value your repo.rb file got for the blob object:
18467+-
18468+-You can then use `git cat-file` to see how big that object is:
18469+-
18470+-Now, modify that file a little, and see what happens:
18471+-
1849918472 -Check the tree created by that commit, and you see something interesting:
1850018473 +[source,console]
1850118474 +----
@@ -18561,7 +18534,7 @@ diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2
1856118534 Wouldn't it be nice if Git could store one of them in full but then the second object only as the delta between it and the first?
1856218535
1856318536 It turns out that it can.
18564-@@ -26,25 +90,74 @@
18537+@@ -28,25 +90,74 @@
1856518538 Git does this if you have too many loose objects around, if you run the `git gc` command manually, or if you push to a remote server.
1856618539 To see what happens, you can manually ask Git to pack up the objects by calling the `git gc` command:
1856718540
@@ -18643,7 +18616,7 @@ diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2
1864318616 The really nice thing about this is that it can be repacked at any time.
1864418617 Git will occasionally repack your database automatically, always trying to save more space, but you can also manually repack at any time by running `git gc` by hand.
1864518618 diff -au /tmp/book/10-git-internals/sections/plumbing-porcelain.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/plumbing-porcelain.asc
18646---- /tmp/book/10-git-internals/sections/plumbing-porcelain.asc.tmp 2020-10-25 11:05:02.503654019 +0900
18619+--- /tmp/book/10-git-internals/sections/plumbing-porcelain.asc.tmp 2020-10-25 13:21:07.193956153 +0900
1864718620 +++ ../../git/progit2/progit2/book/10-git-internals/sections/plumbing-porcelain.asc 2020-06-28 16:44:50.950019034 +0900
1864818621 @@ -1,25 +1,37 @@
1864918622 -[[r_plumbing_porcelain]]
@@ -18696,9 +18669,9 @@ diff -au /tmp/book/10-git-internals/sections/plumbing-porcelain.asc.tmp ../../gi
1869618669 +The `objects` directory stores all the content for your database, the `refs` directory stores pointers into commit objects in that data (branches, tags, remotes and more), the `HEAD` file points to the branch you currently have checked out, and the `index` file is where Git stores your staging area information.
1869718670 You'll now look at each of these sections in detail to see how Git operates.
1869818671 diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/refs.asc
18699---- /tmp/book/10-git-internals/sections/refs.asc.tmp 2020-10-25 11:05:02.508654300 +0900
18672+--- /tmp/book/10-git-internals/sections/refs.asc.tmp 2020-10-25 13:21:07.201956579 +0900
1870018673 +++ ../../git/progit2/progit2/book/10-git-internals/sections/refs.asc 2020-07-04 16:36:46.743685694 +0900
18701-@@ -1,76 +1,182 @@
18674+@@ -1,78 +1,182 @@
1870218675 -[[r_git_refs]]
1870318676 +[[_git_refs]]
1870418677 === Git References
@@ -18777,6 +18750,8 @@ diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/prog
1877718750 +[[ref_the_ref]]
1877818751 ==== The HEAD
1877918752
18753+-==== HEAD
18754+-
1878018755 -The question now is, when you run `git branch (branchname)`, how does Git know the SHA-1 of the last commit?
1878118756 +The question now is, when you run `git branch <branch>`, how does Git know the SHA-1 of the last commit?
1878218757 The answer is the HEAD file.
@@ -18903,7 +18878,7 @@ diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/prog
1890318878
1890418879 ==== Remotes
1890518880
18906-@@ -78,8 +184,26 @@
18881+@@ -80,8 +184,26 @@
1890718882 If you add a remote and push to it, Git stores the value you last pushed to that remote for each branch in the `refs/remotes` directory.
1890818883 For instance, you can add a remote called `origin` and push your `master` branch to it:
1890918884
@@ -18931,13 +18906,15 @@ diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/prog
1893118906 You can `git checkout` to one, but Git won't point HEAD at one, so you'll never update it with a `commit` command.
1893218907 Git manages them as bookmarks to the last known state of where those branches were on those servers.
1893318908 diff -au /tmp/book/10-git-internals/sections/refspec.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/refspec.asc
18934---- /tmp/book/10-git-internals/sections/refspec.asc.tmp 2020-10-25 11:05:02.513654581 +0900
18909+--- /tmp/book/10-git-internals/sections/refspec.asc.tmp 2020-10-25 13:21:07.208956951 +0900
1893518910 +++ ../../git/progit2/progit2/book/10-git-internals/sections/refspec.asc 2020-07-04 16:36:46.743685694 +0900
18936-@@ -1,54 +1,145 @@
18911+@@ -1,56 +1,145 @@
1893718912 -[[r_refspec]]
1893818913 +[[_refspec]]
1893918914 === The Refspec
1894018915
18916+-=== Refspec
18917+-
1894118918 Throughout this book, we've used simple mappings from remote branches to local references, but they can be more complex.
1894218919 -Suppose you add a remote like this:
1894318920 +Suppose you were following along with the last couple sections and had created a small local Git repository, and now wanted to add a _remote_ to it:
@@ -19094,9 +19071,9 @@ diff -au /tmp/book/10-git-internals/sections/refspec.asc.tmp ../../git/progit2/p
1909419071 +$ git push origin --delete topic
1909519072 +----
1909619073 diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../git/progit2/progit2/book/10-git-internals/sections/transfer-protocols.asc
19097---- /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp 2020-10-25 11:05:02.519654919 +0900
19074+--- /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp 2020-10-25 13:21:07.217957430 +0900
1909819075 +++ ../../git/progit2/progit2/book/10-git-internals/sections/transfer-protocols.asc 2020-06-28 16:44:50.950019034 +0900
19099-@@ -8,6 +8,7 @@
19076+@@ -8,58 +8,117 @@
1910019077 If you're setting up a repository to be served read-only over HTTP, the dumb protocol is likely what will be used.
1910119078 This protocol is called ``dumb'' because it requires no Git-specific code on the server side during the transport process; the fetch process is a series of HTTP `GET` requests, where the client can assume the layout of the Git repository on the server.
1910219079
@@ -19104,8 +19081,12 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1910419081 ====
1910519082 The dumb protocol is fairly rarely used these days.
1910619083 It's difficult to secure or make private, so most Git hosts (both cloud-based and on-premises) will refuse to use it.
19107-@@ -16,38 +17,108 @@
19084+ It's generally advised to use the smart protocol, which we describe a bit further on.
19085+ ====
1910819086
19087+-====
19088+-====
19089+-
1910919090 Let's follow the `http-fetch` process for the simplegit library:
1911019091
1911119092 +[source,console]
@@ -19118,7 +19099,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1911819099
1911919100 +[source]
1912019101 +----
19121-+=> GET info/refs
19102+ => GET info/refs
1912219103 +ca82a6dff817ec66f44342007202690a93763949 refs/heads/master
1912319104 +----
1912419105 +
@@ -19127,7 +19108,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1912719108
1912819109 +[source]
1912919110 +----
19130-+=> GET HEAD
19111+ => GET HEAD
1913119112 +ref: refs/heads/master
1913219113 +----
1913319114 +
@@ -19137,7 +19118,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1913719118
1913819119 +[source]
1913919120 +----
19140-+=> GET objects/ca/82a6dff817ec66f44342007202690a93763949
19121+ => GET objects/ca/82a6dff817ec66f44342007202690a93763949
1914119122 +(179 bytes of binary data)
1914219123 +----
1914319124 +
@@ -19159,7 +19140,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1915919140
1916019141 +[source]
1916119142 +----
19162-+=> GET objects/08/5bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
19143+ => GET objects/08/5bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
1916319144 +(179 bytes of data)
1916419145 +----
1916519146 +
@@ -19168,7 +19149,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1916819149
1916919150 +[source]
1917019151 +----
19171-+=> GET objects/cf/da3bf379e4f8dba8717dee55aab78aef7f4daf
19152+ => GET objects/cf/da3bf379e4f8dba8717dee55aab78aef7f4daf
1917219153 +(404 - Not Found)
1917319154 +----
1917419155 +
@@ -19178,7 +19159,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1917819159
1917919160 +[source]
1918019161 +----
19181-+=> GET objects/info/http-alternates
19162+ => GET objects/info/http-alternates
1918219163 +(empty file)
1918319164 +----
1918419165 +
@@ -19188,7 +19169,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1918819169
1918919170 +[source]
1919019171 +----
19191-+=> GET objects/info/packs
19172+ => GET objects/info/packs
1919219173 +P pack-816a9b2334da9953e530f27bcac22082a9f5b835.pack
1919319174 +----
1919419175 +
@@ -19197,7 +19178,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1919719178
1919819179 +[source]
1919919180 +----
19200-+=> GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.idx
19181+ => GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.idx
1920119182 +(4k of binary data)
1920219183 +----
1920319184 +
@@ -19206,14 +19187,14 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1920619187
1920719188 +[source]
1920819189 +----
19209-+=> GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.pack
19190+ => GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.pack
1921019191 +(13k of binary data)
1921119192 +----
1921219193 +
1921319194 You have your tree object, so you continue walking your commits.
1921419195 They're all also within the packfile you just downloaded, so you don't have to do any more requests to your server.
1921519196 Git checks out a working copy of the `master` branch that was pointed to by the HEAD reference you downloaded at the beginning.
19216-@@ -60,24 +131,47 @@
19197+@@ -72,6 +131,7 @@
1921719198
1921819199 ===== Uploading Data
1921919200
@@ -19221,9 +19202,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1922119202 To upload data to a remote process, Git uses the `send-pack` and `receive-pack` processes.
1922219203 The `send-pack` process runs on the client and connects to a `receive-pack` process on the remote side.
1922319204
19224-+====== SSH
19225-+
19226- For example, say you run `git push origin master` in your project, and `origin` is defined as a URL that uses the SSH protocol.
19205+@@ -81,17 +141,37 @@
1922719206 Git fires up the `send-pack` process, which initiates a connection over SSH to your server.
1922819207 It tries to run a command on the remote server via an SSH call that looks something like this:
1922919208
@@ -19264,7 +19243,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1926419243 Git sends a line for each reference you're updating with the line's length, the old SHA-1, the new SHA-1, and the reference that is being updated.
1926519244 The first line also has the client's capabilities.
1926619245 The SHA-1 value of all '0's means that nothing was there before – because you're adding the experiment reference.
19267-@@ -86,24 +180,66 @@
19246+@@ -100,21 +180,42 @@
1926819247 Next, the client sends a packfile of all the objects the server doesn't have yet.
1926919248 Finally, the server responds with a success (or failure) indication:
1927019249
@@ -19273,14 +19252,14 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1927319252 +000eunpack ok
1927419253 +----
1927519254 +
19276-+====== HTTP(S)
19277-+
19255+ ====== HTTP(S)
19256+
1927819257 This process is mostly the same over HTTP, though the handshaking is a bit different.
1927919258 The connection is initiated with this request:
1928019259
1928119260 +[source]
1928219261 +----
19283-+=> GET http://server/simplegit-progit.git/info/refs?service=git-receive-pack
19262+ => GET http://server/simplegit-progit.git/info/refs?service=git-receive-pack
1928419263 +001f# service=git-receive-pack
1928519264 +00ab6c5f0e45abd7832bf23074a333f739977c9e8188 refs/heads/master□report-status \
1928619265 + delete-refs side-band-64k quiet ofs-delta \
@@ -19293,7 +19272,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1929319272
1929419273 +[source]
1929519274 +----
19296-+=> POST http://server/simplegit-progit.git/git-receive-pack
19275+ => POST http://server/simplegit-progit.git/git-receive-pack
1929719276 +----
1929819277 +
1929919278 The `POST` request includes the `send-pack` output and the packfile as its payload.
@@ -19307,8 +19286,8 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1930719286 When you download data, the `fetch-pack` and `upload-pack` processes are involved.
1930819287 The client initiates a `fetch-pack` process that connects to an `upload-pack` process on the remote side to negotiate what data will be transferred down.
1930919288
19310-+====== SSH
19311-+
19289+@@ -122,8 +223,23 @@
19290+
1931219291 If you're doing the fetch over SSH, `fetch-pack` runs something like this:
1931319292
1931419293 +[source,console]
@@ -19331,7 +19310,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1933119310 This is very similar to what `receive-pack` responds with, but the capabilities are different.
1933219311 In addition, it sends back what HEAD points to (`symref=HEAD:refs/heads/master`) so the client knows what to check out if this is a clone.
1933319312
19334-@@ -111,11 +247,41 @@
19313+@@ -131,15 +247,41 @@
1933519314 It sends all the objects it already has with ``have'' and then the SHA-1.
1933619315 At the end of this list, it writes ``done'' to initiate the `upload-pack` process to begin sending the packfile of the data it needs:
1933719316
@@ -19343,14 +19322,14 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1934319322 +0000
1934419323 +----
1934519324 +
19346-+====== HTTP(S)
19347-+
19325+ ====== HTTP(S)
19326+
1934819327 The handshake for a fetch operation takes two HTTP requests.
1934919328 The first is a `GET` to the same endpoint used in the dumb protocol:
1935019329
1935119330 +[source]
1935219331 +----
19353-+=> GET $GIT_URL/info/refs?service=git-upload-pack
19332+ => GET $GIT_URL/info/refs?service=git-upload-pack
1935419333 +001e# service=git-upload-pack
1935519334 +00e7ca82a6dff817ec66f44342007202690a93763949 HEAD□multi_ack thin-pack \
1935619335 + side-band side-band-64k ofs-delta shallow no-progress include-tag \
@@ -19364,7 +19343,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1936419343
1936519344 +[source]
1936619345 +----
19367-+=> POST $GIT_URL/git-upload-pack HTTP/1.0
19346+ => POST $GIT_URL/git-upload-pack HTTP/1.0
1936819347 +0032want 0a53e9ddeaddad63ad106860237bbf53411d11a7
1936919348 +0032have 441b40d833fdfa93eb2908e52742248faf0ee993
1937019349 +0000
@@ -19374,7 +19353,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi
1937419353 The response to this request indicates success or failure, and includes the packfile.
1937519354
1937619355 diff -au /tmp/book/A-git-in-other-environments/sections/bash.asc.tmp ../../git/progit2/progit2/book/A-git-in-other-environments/sections/bash.asc
19377---- /tmp/book/A-git-in-other-environments/sections/bash.asc.tmp 2020-10-25 11:05:02.524655200 +0900
19356+--- /tmp/book/A-git-in-other-environments/sections/bash.asc.tmp 2020-10-25 13:21:07.228958015 +0900
1937819357 +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/bash.asc 2020-07-04 16:36:46.743685694 +0900
1937919358 @@ -1,12 +1,23 @@
1938019359 === Git in Bash
@@ -19422,7 +19401,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/bash.asc.tmp ../../git/p
1942219401
1942319402 Both of these scripts come with helpful documentation; take a look at the contents of `git-completion.bash` and `git-prompt.sh` for more information.
1942419403 diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/progit2/progit2/book/A-git-in-other-environments/sections/guis.asc
19425---- /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp 2020-10-25 11:05:02.530655537 +0900
19404+--- /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp 2020-10-25 13:21:07.236958440 +0900
1942619405 +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/guis.asc 2020-07-04 16:36:46.743685694 +0900
1942719406 @@ -1,5 +1,6 @@
1942819407 === Graphical Interfaces
@@ -19509,8 +19488,13 @@ diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/p
1950919488 * On the right is a diff view, which shows what's changed in your working directory, or which changes were included in the selected commit.
1951019489 * The last thing to notice is the ``Sync'' button at the top-right, which is the primary way you interact over the network.
1951119490
19512-@@ -87,12 +96,12 @@
19491+@@ -85,17 +94,14 @@
19492+ While they're designed to highlight GitHub's service and recommended workflow, they will happily work with any repository, and do network operations with any Git host.
19493+ ====
1951319494
19495+-====
19496+-====
19497+-
1951419498 ===== Installation
1951519499
1951619500 -GitHub for Windows can be downloaded from https://windows.github.com[], and GitHub for Mac from https://mac.github.com[].
@@ -19524,7 +19508,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/p
1952419508
1952519509 The next step is to give the tool some repositories to work with.
1952619510 The client shows you a list of the repositories you have access to on GitHub, and can clone them in one step.
19527-@@ -102,18 +111,18 @@
19511+@@ -105,18 +111,18 @@
1952819512
1952919513 Once it's installed and configured, you can use the GitHub client for many common Git tasks.
1953019514 The intended workflow for this tool is sometimes called the ``GitHub Flow.''
@@ -19549,7 +19533,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/p
1954919533
1955019534 Once your branch is created, making new commits is fairly straightforward.
1955119535 Make some changes in your working directory, and when you switch to the GitHub client window, it will show you which files changed.
19552-@@ -135,8 +144,9 @@
19536+@@ -138,8 +144,9 @@
1955319537 Developers and non-developers alike can be collaborating on a project within minutes, and many of the best practices for this kind of workflow are baked into the tools.
1955419538 However, if your workflow is different, or you want more control over how and when network operations are done, we recommend you use another client or the command line.
1955519539
@@ -19562,7 +19546,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/p
1956219546 A more comprehensive list is available on the Git wiki site, at https://git.wiki.kernel.org/index.php/Interfaces,_frontends,_and_tools#Graphical_Interfaces[].
1956319547 Warning: file not found: ../../git/progit2/progit2-ja/book/A-git-in-other-environments/sections/jetbrainsides.asc
1956419548 diff -au /tmp/book/A-git-in-other-environments/sections/powershell.asc.tmp ../../git/progit2/progit2/book/A-git-in-other-environments/sections/powershell.asc
19565---- /tmp/book/A-git-in-other-environments/sections/powershell.asc.tmp 2020-10-25 11:05:02.535655818 +0900
19549+--- /tmp/book/A-git-in-other-environments/sections/powershell.asc.tmp 2020-10-25 13:21:07.246958972 +0900
1956619550 +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/powershell.asc 2020-07-04 16:36:46.743685694 +0900
1956719551 @@ -1,16 +1,86 @@
1956819552 -[[r_git_powershell]]
@@ -19663,7 +19647,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/powershell.asc.tmp ../..
1966319647 +For more details on how to customize your posh-git prompt see: https://github.com/dahlbyk/posh-git/blob/master/README.md#customization-variables[].
1966419648 Warning: file not found: ../../git/progit2/progit2-ja/book/A-git-in-other-environments/sections/sublimetext.asc
1966519649 diff -au /tmp/book/A-git-in-other-environments/sections/visualstudio.asc.tmp ../../git/progit2/progit2/book/A-git-in-other-environments/sections/visualstudio.asc
19666---- /tmp/book/A-git-in-other-environments/sections/visualstudio.asc.tmp 2020-10-25 11:05:02.539656043 +0900
19650+--- /tmp/book/A-git-in-other-environments/sections/visualstudio.asc.tmp 2020-10-25 13:21:07.254959398 +0900
1966719651 +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/visualstudio.asc 2020-07-13 09:35:20.947908596 +0900
1966819652 @@ -1,5 +1,6 @@
1966919653 === Git in Visual Studio
@@ -19700,7 +19684,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/visualstudio.asc.tmp ../
1970019684 +For more on using Git within Visual Studio go to: https://docs.microsoft.com/en-us/azure/devops/repos/git/command-prompt?view=azure-devops[].
1970119685 Warning: file not found: ../../git/progit2/progit2-ja/book/A-git-in-other-environments/sections/visualstudiocode.asc
1970219686 diff -au /tmp/book/A-git-in-other-environments/sections/zsh.asc.tmp ../../git/progit2/progit2/book/A-git-in-other-environments/sections/zsh.asc
19703---- /tmp/book/A-git-in-other-environments/sections/zsh.asc.tmp 2020-10-25 11:05:02.545656381 +0900
19687+--- /tmp/book/A-git-in-other-environments/sections/zsh.asc.tmp 2020-10-25 13:21:07.263959876 +0900
1970419688 +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/zsh.asc 2020-07-04 16:36:46.743685694 +0900
1970519689 @@ -1,34 +1,55 @@
1970619690 === Git in Zsh
@@ -19773,9 +19757,9 @@ diff -au /tmp/book/B-embedding-git/sections/command-line.asc.tmp ../../git/progi
1977319757 Warning: file not found: ../../git/progit2/progit2-ja/book/B-embedding-git/sections/dulwich.asc
1977419758 Warning: file not found: ../../git/progit2/progit2-ja/book/B-embedding-git/sections/go-git.asc
1977519759 diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progit2/book/B-embedding-git/sections/jgit.asc
19776---- /tmp/book/B-embedding-git/sections/jgit.asc.tmp 2020-10-25 11:05:02.555656943 +0900
19760+--- /tmp/book/B-embedding-git/sections/jgit.asc.tmp 2020-10-25 13:21:07.280960781 +0900
1977719761 +++ ../../git/progit2/progit2/book/B-embedding-git/sections/jgit.asc 2020-06-28 16:44:50.955019770 +0900
19778-@@ -1,27 +1,45 @@
19762+@@ -1,21 +1,36 @@
1977919763 === JGit
1978019764
1978119765 -(((jgit)))(((java)))
@@ -19813,11 +19797,10 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1981319797 +java -cp .:org.eclipse.jgit-3.5.0.201409260305-r.jar App
1981419798 +----
1981519799 +
19816-+==== Plumbing
19817-+
19818- JGit has two basic levels of API: plumbing and porcelain.
19819- The terminology for these comes from Git itself, and JGit is divided into roughly the same kinds of areas: porcelain APIs are a friendly front-end for common user-level actions (the sorts of things a normal user would use the Git command-line tool for), while the plumbing APIs are for interacting with low-level repository objects directly.
19800+ ==== Plumbing
1982019801
19802+ JGit has two basic levels of API: plumbing and porcelain.
19803+@@ -24,6 +39,7 @@
1982119804 The starting point for most JGit sessions is the `Repository` class, and the first thing you'll want to do is create an instance of it.
1982219805 For a filesystem-based repository (yes, JGit allows for other storage models), this is accomplished using `FileRepositoryBuilder`:
1982319806
@@ -19825,7 +19808,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1982519808 ----
1982619809 // Create a new repository
1982719810 Repository newlyCreatedRepo = FileRepositoryBuilder.create(
19828-@@ -40,6 +58,7 @@
19811+@@ -42,6 +58,7 @@
1982919812 Once you have a `Repository` instance, you can do all sorts of things with it.
1983019813 Here's a quick sampling:
1983119814
@@ -19833,7 +19816,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1983319816 ----
1983419817 // Get a reference
1983519818 Ref master = repo.getRef("master");
19836-@@ -72,13 +91,13 @@
19819+@@ -74,13 +91,13 @@
1983719820 There's quite a bit going on here, so let's go through it one section at a time.
1983819821
1983919822 The first line gets a pointer to the `master` reference.
@@ -19849,12 +19832,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1984919832
1985019833 The next two lines show how to load the raw contents of an object.
1985119834 In this example, we call `ObjectLoader.copyTo()` to stream the contents of the object directly to stdout, but ObjectLoader also has methods to read the type and size of an object, as well as return it as a byte array.
19852-@@ -96,9 +115,12 @@
19853- Also not shown here is the way JGit handles errors, which is through the use of exceptions.
19854- JGit APIs sometimes throw standard Java exceptions (such as `IOException`), but there are a host of JGit-specific exception types that are provided as well (such as `NoRemoteRepositoryException`, `CorruptObjectException`, and `NoMergeBaseException`).
19855-
19856-+==== Porcelain
19857-+
19835+@@ -103,6 +120,7 @@
1985819836 The plumbing APIs are rather complete, but it can be cumbersome to string them together to achieve common goals, like adding a file to the index, or making a new commit.
1985919837 JGit provides a higher-level set of APIs to help out with this, and the entry point to these APIs is the `Git` class:
1986019838
@@ -19862,7 +19840,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1986219840 ----
1986319841 Repository repo;
1986419842 // construct repo...
19865-@@ -106,7 +128,21 @@
19843+@@ -110,7 +128,21 @@
1986619844 ----
1986719845
1986819846 The Git class has a nice set of high-level _builder_-style methods that can be used to construct some pretty complex behavior.
@@ -19885,7 +19863,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1988519863
1988619864 This is a common pattern with the Git class; the methods return a command object that lets you chain method calls to set parameters, which are executed when you call `.call()`.
1988719865 In this case, we're asking the `origin` remote for tags, but not heads.
19888-@@ -119,7 +155,6 @@
19866+@@ -123,7 +155,6 @@
1988919867 This is only a small sampling of JGit's full capabilities.
1989019868 If you're interested and want to learn more, here's where to look for information and inspiration:
1989119869
@@ -19895,7 +19873,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi
1989519873 * The JGit Cookbook at https://github.com/centic9/jgit-cookbook[] has many examples of how to do specific tasks with JGit.
1989619874 -* There are several good resources pointed out at http://stackoverflow.com/questions/6861881[].
1989719875 diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/progit2/book/B-embedding-git/sections/libgit2.asc
19898---- /tmp/book/B-embedding-git/sections/libgit2.asc.tmp 2020-10-25 11:05:02.569657731 +0900
19876+--- /tmp/book/B-embedding-git/sections/libgit2.asc.tmp 2020-10-25 13:21:07.291961366 +0900
1989919877 +++ ../../git/progit2/progit2/book/B-embedding-git/sections/libgit2.asc 2020-07-01 10:48:37.625009675 +0900
1990019878 @@ -1,13 +1,15 @@
1990119879 === Libgit2
@@ -20059,12 +20037,10 @@ diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/pr
2005920037 ==== Other Bindings
2006020038
2006120039 Libgit2 has bindings for many languages.
20062-@@ -105,21 +186,43 @@
20063- The official collection of bindings can be found by browsing the repositories at https://github.com/libgit2[].
20064- The code we'll write will return the commit message from the commit eventually pointed to by HEAD (sort of like `git log -1`).
20040+@@ -107,25 +188,41 @@
20041+
20042+ ===== LibGit2Sharp
2006520043
20066-+===== LibGit2Sharp
20067-+
2006820044 +(((.NET)))(((C#)))(((Mono)))
2006920045 If you're writing a .NET or Mono application, LibGit2Sharp (https://github.com/libgit2/libgit2sharp[]) is what you're looking for.
2007020046 The bindings are written in C#, and great care has been taken to wrap the raw Libgit2 calls with native-feeling CLR APIs.
@@ -20077,8 +20053,8 @@ diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/pr
2007720053 +
2007820054 For desktop Windows applications, there's even a NuGet package that will help you get started quickly.
2007920055
20080-+===== objective-git
20081-+
20056+ ===== objective-git
20057+
2008220058 +(((Apple)))(((Objective-C)))(((Cocoa)))
2008320059 If your application is running on an Apple platform, you're likely using Objective-C as your implementation language.
2008420060 Objective-Git (https://github.com/libgit2/objective-git[]) is the name of the Libgit2 bindings for that environment.
@@ -20093,9 +20069,9 @@ diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/pr
2009320069 +
2009420070 Objective-git is fully interoperable with Swift, so don't fear if you've left Objective-C behind.
2009520071
20072+ ===== pygit2
20073+
2009620074 -The bindings for Libgit2 in Python are called Pygit2, and can be found at http://www.pygit2.org/[].
20097-+===== pygit2
20098-+
2009920075 +(((Python)))
2010020076 +The bindings for Libgit2 in Python are called Pygit2, and can be found at https://www.pygit2.org[].
2010120077 Our example program:
@@ -20105,7 +20081,7 @@ diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/pr
2010520081 pygit2.Repository("/path/to/repo") # open repository
2010620082 .head # get the current branch
2010720083 diff -au /tmp/book/contributors.asc.tmp ../../git/progit2/progit2/book/contributors.asc
20108---- /tmp/book/contributors.asc.tmp 2020-10-25 11:05:02.575658068 +0900
20084+--- /tmp/book/contributors.asc.tmp 2020-10-25 13:21:07.299961791 +0900
2010920085 +++ ../../git/progit2/progit2/book/contributors.asc 2020-06-28 16:44:50.955019770 +0900
2011020086 @@ -1,4 +1,12 @@
2011120087 [preface]
@@ -20122,7 +20098,7 @@ diff -au /tmp/book/contributors.asc.tmp ../../git/progit2/progit2/book/contribut
2012220098 +----
2012320099 +
2012420100 diff -au /tmp/book/dedication.asc.tmp ../../git/progit2/progit2/book/dedication.asc
20125---- /tmp/book/dedication.asc.tmp 2020-10-25 11:05:02.579658293 +0900
20101+--- /tmp/book/dedication.asc.tmp 2020-10-25 13:21:07.307962217 +0900
2012620102 +++ ../../git/progit2/progit2/book/dedication.asc 2020-06-28 16:44:50.960020506 +0900
2012720103 @@ -1,8 +1,8 @@
2012820104 -[preface]
@@ -20137,12 +20113,12 @@ diff -au /tmp/book/dedication.asc.tmp ../../git/progit2/progit2/book/dedication.
2013720113 +To my wife Jessica who has supported me for all of these years and to my daughter Josephine,
2013820114 who will support me when I'm too old to know what's going on. — Scott_
2013920115 diff -au /tmp/book/index.asc.tmp ../../git/progit2/progit2/book/index.asc
20140---- /tmp/book/index.asc.tmp 2020-10-25 11:05:02.584658574 +0900
20116+--- /tmp/book/index.asc.tmp 2020-10-25 13:21:07.317962749 +0900
2014120117 +++ ../../git/progit2/progit2/book/index.asc 2020-06-28 16:44:50.960020506 +0900
2014220118 @@ -0,0 +1 @@
2014320119 +== Index
2014420120 diff -au /tmp/book/introduction.asc.tmp ../../git/progit2/progit2/book/introduction.asc
20145---- /tmp/book/introduction.asc.tmp 2020-10-25 11:05:02.588658799 +0900
20121+--- /tmp/book/introduction.asc.tmp 2020-10-25 13:21:07.326963228 +0900
2014620122 +++ ../../git/progit2/progit2/book/introduction.asc 2020-06-28 16:44:50.960020506 +0900
2014720123 @@ -1,69 +1,58 @@
2014820124 [preface]
@@ -20267,7 +20243,7 @@ diff -au /tmp/book/introduction.asc.tmp ../../git/progit2/progit2/book/introduct
2026720243 -Let’s get started.
2026820244 +Let's get started.
2026920245 diff -au /tmp/book/license.asc.tmp ../../git/progit2/progit2/book/license.asc
20270---- /tmp/book/license.asc.tmp 2020-10-25 11:05:02.593659081 +0900
20246+--- /tmp/book/license.asc.tmp 2020-10-25 13:21:07.334963653 +0900
2027120247 +++ ../../git/progit2/progit2/book/license.asc 2020-06-28 16:44:50.961020654 +0900
2027220248 @@ -0,0 +1,4 @@
2027320249 +[preface]
@@ -20275,7 +20251,7 @@ diff -au /tmp/book/license.asc.tmp ../../git/progit2/progit2/book/license.asc
2027520251 +
2027620252 +include::../LICENSE.asc[]
2027720253 diff -au /tmp/book/preface_ben.asc.tmp ../../git/progit2/progit2/book/preface_ben.asc
20278---- /tmp/book/preface_ben.asc.tmp 2020-10-25 11:05:02.597659305 +0900
20254+--- /tmp/book/preface_ben.asc.tmp 2020-10-25 13:21:07.341964025 +0900
2027920255 +++ ../../git/progit2/progit2/book/preface_ben.asc 2020-06-28 16:44:50.961020654 +0900
2028020256 @@ -1,8 +1,12 @@
2028120257 [preface]
@@ -20295,14 +20271,14 @@ diff -au /tmp/book/preface_ben.asc.tmp ../../git/progit2/progit2/book/preface_be
2029520271 +I hope it helps you as much as it did me.
2029620272 Warning: file not found: ../../git/progit2/progit2-ja/book/preface_schacon.asc
2029720273 diff -au /tmp/book/toc.asc.tmp ../../git/progit2/progit2/book/toc.asc
20298---- /tmp/book/toc.asc.tmp 2020-10-25 11:05:02.601659530 +0900
20274+--- /tmp/book/toc.asc.tmp 2020-10-25 13:21:07.348964398 +0900
2029920275 +++ ../../git/progit2/progit2/book/toc.asc 2020-06-28 16:44:50.961020654 +0900
2030020276 @@ -0,0 +1 @@
2030120277 +{{ toc }}
2030220278 Warning: file not found: ../../git/progit2/progit2-ja/ch01-getting-started.asc
2030320279 Warning: file not found: ../../git/progit2/progit2-ja/ch02-git-basics-chapter.asc
2030420280 diff -au /tmp/ch03-git-branching.asc.tmp ../../git/progit2/progit2/ch03-git-branching.asc
20305---- /tmp/ch03-git-branching.asc.tmp 2020-10-25 11:05:02.606659812 +0900
20281+--- /tmp/ch03-git-branching.asc.tmp 2020-10-25 13:21:07.357964876 +0900
2030620282 +++ ../../git/progit2/progit2/ch03-git-branching.asc 2020-06-28 16:44:50.963020948 +0900
2030720283 @@ -1,7 +1,7 @@
2030820284 -[#ch03-git-branching]
@@ -20316,7 +20292,7 @@ diff -au /tmp/ch03-git-branching.asc.tmp ../../git/progit2/progit2/ch03-git-bran
2031620292 In many VCS tools, this is a somewhat expensive process, often requiring you to create a new copy of your source code directory, which can take a long time for large projects.
2031720293 Warning: file not found: ../../git/progit2/progit2-ja/ch04-git-on-the-server.asc
2031820294 diff -au /tmp/ch05-distributed-git.asc.tmp ../../git/progit2/progit2/ch05-distributed-git.asc
20319---- /tmp/ch05-distributed-git.asc.tmp 2020-10-25 11:05:02.610660037 +0900
20295+--- /tmp/ch05-distributed-git.asc.tmp 2020-10-25 13:21:07.364965249 +0900
2032020296 +++ ../../git/progit2/progit2/ch05-distributed-git.asc 2020-06-28 16:44:50.963020948 +0900
2032120297 @@ -1,8 +1,8 @@
2032220298 -[#ch05-distributed-git]
@@ -20331,7 +20307,7 @@ diff -au /tmp/ch05-distributed-git.asc.tmp ../../git/progit2/progit2/ch05-distri
2033120307 In this chapter, you'll see how to work with Git in a distributed environment as a contributor and an integrator.
2033220308 That is, you'll learn how to contribute code successfully to a project and make it as easy on you and the project maintainer as possible, and also how to maintain a project successfully with a number of developers contributing.
2033320309 diff -au /tmp/ch06-github.asc.tmp ../../git/progit2/progit2/ch06-github.asc
20334---- /tmp/ch06-github.asc.tmp 2020-10-25 11:05:02.615660318 +0900
20310+--- /tmp/ch06-github.asc.tmp 2020-10-25 13:21:07.374965781 +0900
2033520311 +++ ../../git/progit2/progit2/ch06-github.asc 2020-06-28 16:44:50.963020948 +0900
2033620312 @@ -1,5 +1,4 @@
2033720313 -[#ch06-github]
@@ -20340,7 +20316,7 @@ diff -au /tmp/ch06-github.asc.tmp ../../git/progit2/progit2/ch06-github.asc
2034020316 == GitHub
2034120317
2034220318 (((GitHub)))
20343-@@ -12,6 +11,7 @@
20319+@@ -12,14 +11,13 @@
2034420320
2034520321 If you are not interested in using GitHub to host your own projects or to collaborate with other projects that are hosted on GitHub, you can safely skip to <<ch07-git-tools#ch07-git-tools>>.
2034620322
@@ -20348,8 +20324,16 @@ diff -au /tmp/ch06-github.asc.tmp ../../git/progit2/progit2/ch06-github.asc
2034820324 .Interfaces Change
2034920325 ====
2035020326 It's important to note that like many active websites, the UI elements in these screenshots are bound to change over time.
20327+ Hopefully the general idea of what we're trying to accomplish here will still be there, but if you want more up to date versions of these screens, the online versions of this book may have newer screenshots.
20328+ ====
20329+
20330+-====
20331+-====
20332+ include::book/06-github/sections/1-setting-up-account.asc[]
20333+
20334+ include::book/06-github/sections/2-contributing.asc[]
2035120335 diff -au /tmp/ch07-git-tools.asc.tmp ../../git/progit2/progit2/ch07-git-tools.asc
20352---- /tmp/ch07-git-tools.asc.tmp 2020-10-25 11:05:02.620660599 +0900
20336+--- /tmp/ch07-git-tools.asc.tmp 2020-10-25 13:21:07.380966100 +0900
2035320337 +++ ../../git/progit2/progit2/ch07-git-tools.asc 2020-06-28 16:44:50.963020948 +0900
2035420338 @@ -1,11 +1,10 @@
2035520339 -[#ch07-git-tools]
@@ -20379,7 +20363,7 @@ diff -au /tmp/ch07-git-tools.asc.tmp ../../git/progit2/progit2/ch07-git-tools.as
2037920363 +If you want to use subprojects in your project, you've learned how to accommodate those needs.
2038020364 +At this point, you should be able to do most of the things in Git that you'll need on the command line day to day and feel comfortable doing so.
2038120365 diff -au /tmp/ch08-customizing-git.asc.tmp ../../git/progit2/progit2/ch08-customizing-git.asc
20382---- /tmp/ch08-customizing-git.asc.tmp 2020-10-25 11:05:02.624660824 +0900
20366+--- /tmp/ch08-customizing-git.asc.tmp 2020-10-25 13:21:07.390966632 +0900
2038320367 +++ ../../git/progit2/progit2/ch08-customizing-git.asc 2020-06-28 16:44:50.964021095 +0900
2038420368 @@ -1,5 +1,4 @@
2038520369 -[#ch08-customizing-git]
@@ -20390,7 +20374,7 @@ diff -au /tmp/ch08-customizing-git.asc.tmp ../../git/progit2/progit2/ch08-custom
2039020374 So far, we've covered the basics of how Git works and how to use it, and we've introduced a number of tools that Git provides to help you use it easily and efficiently.
2039120375 Warning: file not found: ../../git/progit2/progit2-ja/ch09-git-and-other-systems.asc
2039220376 diff -au /tmp/ch10-git-internals.asc.tmp ../../git/progit2/progit2/ch10-git-internals.asc
20393---- /tmp/ch10-git-internals.asc.tmp 2020-10-25 11:05:02.628661049 +0900
20377+--- /tmp/ch10-git-internals.asc.tmp 2020-10-25 13:21:07.396966951 +0900
2039420378 +++ ../../git/progit2/progit2/ch10-git-internals.asc 2020-06-28 16:44:50.964021095 +0900
2039520379 @@ -1,9 +1,8 @@
2039620380 -[#ch10-git-internals]
@@ -20428,14 +20412,14 @@ diff -au /tmp/ch10-git-internals.asc.tmp ../../git/progit2/progit2/ch10-git-inte
2042820412 Git as a content-addressable filesystem is a very powerful tool that you can easily use as more than just a VCS.
2042920413 We hope you can use your newfound knowledge of Git internals to implement your own cool application of this technology and feel more comfortable using Git in more advanced ways.
2043020414 diff -au /tmp/index.asc.tmp ../../git/progit2/progit2/index.asc
20431---- /tmp/index.asc.tmp 2020-10-25 11:05:02.633661330 +0900
20415+--- /tmp/index.asc.tmp 2020-10-25 13:21:07.403967323 +0900
2043220416 +++ ../../git/progit2/progit2/index.asc 2020-06-28 16:44:51.438090759 +0900
2043320417 @@ -0,0 +1,3 @@
2043420418 +[#index]
2043520419 +[index]
2043620420 += Index
2043720421 diff -au /tmp/progit.asc.tmp ../../git/progit2/progit2/progit.asc
20438---- /tmp/progit.asc.tmp 2020-10-25 11:05:02.637661555 +0900
20422+--- /tmp/progit.asc.tmp 2020-10-25 13:21:07.411967749 +0900
2043920423 +++ ../../git/progit2/progit2/progit.asc 2020-06-28 16:44:51.438090759 +0900
2044020424 @@ -0,0 +1,52 @@
2044120425 +Pro Git
--- a/progit2ja_diff/progit2ja_diff.perl
+++ b/progit2ja_diff/progit2ja_diff.perl
@@ -40,6 +40,7 @@
4040 ### Creative Commons Attribution-NonCommercial-ShareAlike 3.0 とします。
4141
4242 use strict;
43+use Encode qw/decode_utf8 encode_utf8/;
4344 use File::Basename;
4445 use File::Path;
4546
@@ -109,6 +110,12 @@ sub output_ja_tempfile {
109110 if ($found_slashes_status == 2) {
110111 if ($line =~ /^include/) {
111112 $to_be_read = 1; $continue_flag = 1;
113+ } elsif ($line =~ /^[=]+/) {
114+ if (decode_utf8($line) =~ /[\p{Han}|\p{Hiragana}|\p{Katakana}]+/) {
115+ $to_be_read = 0; $continue_flag = 0;
116+ } else {
117+ $to_be_read = 1; $continue_flag = 1;
118+ }
112119 } elsif ($line =~ /^\n/) {
113120 if ($continue_flag == 0) {
114121 $to_be_read = 0; $continue_flag = 0;