Révision | 153a3d3c04c069d0ef1a2e8f42fcf386710a7f15 (tree) |
---|---|
l'heure | 2020-10-25 13:21:29 |
Auteur | matsuand <30614168+matsuand@user...> |
Commiter | matsuand |
日本語訳段落に続いた正規のオリジナル文への対処(===への対処)。20201025結果修正。
@@ -1,5 +1,5 @@ | ||
1 | 1 | 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 | |
3 | 3 | +++ ../../git/progit2/progit2/A-git-in-other-environments.asc 2020-08-29 09:58:24.046195489 +0900 |
4 | 4 | @@ -1,4 +1,4 @@ |
5 | 5 | -[#A-git-in-other-environments] |
@@ -22,7 +22,7 @@ diff -au /tmp/A-git-in-other-environments.asc.tmp ../../git/progit2/progit2/A-gi | ||
22 | 22 | |
23 | 23 | Warning: file not found: ../../git/progit2/progit2-ja/B-embedding-git-in-your-applications.asc |
24 | 24 | 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 | |
26 | 26 | +++ ../../git/progit2/progit2/C-git-commands.asc 2020-08-17 16:38:51.074694961 +0900 |
27 | 27 | @@ -1,4 +1,4 @@ |
28 | 28 | -[#C-git-commands] |
@@ -30,7 +30,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
30 | 30 | [appendix] |
31 | 31 | == Git Commands |
32 | 32 | |
33 | -@@ -8,10 +8,20 @@ | |
33 | +@@ -8,6 +8,14 @@ | |
34 | 34 | In this appendix, we'll go through all the Git commands we addressed throughout the book, grouped roughly by what they're used for. |
35 | 35 | 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. |
36 | 36 |
@@ -45,29 +45,25 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
45 | 45 | === Setup and Config |
46 | 46 | |
47 | 47 | 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 @@ | |
55 | 49 | |
56 | 50 | The `git config` command has been used in nearly every chapter of the book. |
57 | 51 | |
58 | 52 | -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. | |
59 | 55 | +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. |
60 | 56 | |
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`. | |
62 | 58 | +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. |
63 | 59 | |
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. | |
65 | 61 | +In <<ch03-git-branching#_rebasing>> we used it to make `--rebase` the default when you run `git pull`. |
66 | 62 | |
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. | |
68 | 64 | +In <<ch07-git-tools#_credential_caching>> we used it to set up a default store for your HTTP passwords. |
69 | 65 | |
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. | |
71 | 67 | +In <<ch08-customizing-git#_keyword_expansion>> we showed how to set up smudge and clean filters on content coming in and out of Git. |
72 | 68 | + |
73 | 69 | +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 | ||
109 | 105 | +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. |
110 | 106 | +==== |
111 | 107 | |
112 | --Finally, basically the entirety of <<ch08-customizing-git#r_git_config>> is dedicated to the command. | |
113 | -+==== git help | |
108 | + ==== git help | |
114 | 109 | |
115 | 110 | The `git help` command is used to show you all the documentation shipped with Git about any command. |
116 | 111 | 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 | ||
121 | 116 | |
122 | 117 | === Getting and Creating Projects |
123 | 118 | |
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 @@ | |
126 | 120 | |
127 | -+==== git init | |
128 | -+ | |
129 | 121 | 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`. |
130 | 122 | |
131 | 123 | -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 | ||
139 | 131 | |
140 | 132 | -Finally, we go through some of the details of what it actually does behind the scenes in <<ch10-git-internals#r_plumbing_porcelain>>. |
141 | 133 | +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 | |
144 | 134 | |
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 @@ | |
147 | 138 | |
148 | 139 | The `git clone` command is used in dozens of places throughout the book, but we'll just list a few interesting places. |
149 | 140 |
@@ -165,12 +156,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
165 | 156 | === Basic Snapshotting |
166 | 157 | |
167 | 158 | 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 @@ | |
174 | 160 | This command is an incredibly important command in Git and is mentioned or used dozens of times in this book. |
175 | 161 | We'll quickly cover some of the unique uses that can be found. |
176 | 162 |
@@ -185,10 +171,10 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
185 | 171 | |
186 | 172 | -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. |
187 | 173 | +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 | |
190 | 174 | |
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 @@ | |
192 | 178 | Which files are modified and unstaged and which are staged but not yet committed. |
193 | 179 | In its normal form, it also will show you some basic hints on how to move files between these stages. |
194 | 180 |
@@ -196,34 +182,34 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
196 | 182 | +We first cover `status` in <<ch02-git-basics-chapter#_checking_status>>, both in its basic and simplified forms. |
197 | 183 | While we use it throughout the book, pretty much everything you can do with the `git status` command is covered there. |
198 | 184 | |
199 | -+==== git diff | |
200 | -+ | |
185 | + ==== git diff | |
186 | +@@ -108,36 +155,36 @@ | |
201 | 187 | The `git diff` command is used when you want to see differences between any two trees. |
202 | 188 | 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`). |
203 | 189 | |
204 | 190 | -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. |
205 | 191 | +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>>. | |
208 | 192 | |
209 | 193 | -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>>. | |
211 | 195 | |
212 | 196 | -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>>. | |
214 | 198 | |
215 | 199 | -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>>. | |
217 | 201 | |
218 | 202 | -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 | |
220 | 206 | |
221 | 207 | 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. |
222 | 208 | |
223 | 209 | -We only briefly mention this in <<ch02-git-basics#r_git_diff_staged>>. |
224 | 210 | +We only briefly mention this in <<ch02-git-basics-chapter#_git_diff_staged>>. |
225 | -+ | |
226 | -+==== git commit | |
211 | + | |
212 | + ==== git commit | |
227 | 213 | |
228 | 214 | 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. |
229 | 215 |
@@ -233,32 +219,32 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
233 | 219 | |
234 | 220 | -In <<ch02-git-basics#r_undoing>> we cover using the `--amend` option to redo the most recent commit. |
235 | 221 | +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. | |
238 | 222 | |
239 | 223 | -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. | |
241 | 225 | |
242 | 226 | -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>>. | |
244 | 228 | |
245 | 229 | -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 | |
247 | 233 | |
248 | - The `git reset` command is primarily used to undo things, as you can possibly tell by the verb. | |
234 | +@@ -145,34 +192,34 @@ | |
249 | 235 | 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`. |
250 | 236 | 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. |
251 | 237 | |
252 | 238 | -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. |
253 | 239 | +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. | |
256 | 240 | |
257 | 241 | -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. | |
259 | 243 | |
260 | 244 | -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 | |
262 | 248 | |
263 | 249 | The `git rm` command is used to remove files from the staging area and working directory for Git. |
264 | 250 | 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 | ||
270 | 256 | +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. |
271 | 257 | This can be useful for scripting purposes. |
272 | 258 | |
273 | -+==== git mv | |
274 | -+ | |
259 | + ==== git mv | |
260 | + | |
275 | 261 | 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. |
276 | 262 | |
277 | 263 | -We only briefly mention this command in <<ch02-git-basics#r_git_mv>>. |
278 | 264 | +We only briefly mention this command in <<ch02-git-basics-chapter#_git_mv>>. |
279 | -+ | |
280 | -+==== git clean | |
265 | + | |
266 | + ==== git clean | |
281 | 267 | |
282 | 268 | The `git clean` command is used to remove unwanted files from your working directory. |
283 | 269 | 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 | ||
287 | 273 | |
288 | 274 | === Branching and Merging |
289 | 275 | |
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 @@ | |
295 | 277 | It can list the branches you have, create a new branch, delete branches and rename branches. |
296 | 278 | |
297 | 279 | Most of <<ch03-git-branching#ch03-git-branching>> is dedicated to the `branch` command and it's used throughout the entire chapter. |
298 | 280 | -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>>. |
299 | 281 | +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. | |
302 | 282 | |
303 | 283 | -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. | |
305 | 285 | |
306 | 286 | -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 | |
308 | 290 | |
309 | 291 | The `git checkout` command is used to switch branches and check content out into your working directory. |
310 | 292 |
@@ -322,8 +304,8 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
322 | 304 | |
323 | 305 | -Finally, we go into some implementation detail in <<ch10-git-internals#r_the_head>>. |
324 | 306 | +Finally, we go into some implementation detail in <<ch10-git-internals#ref_the_ref>>. |
325 | -+ | |
326 | -+==== git merge | |
307 | + | |
308 | + ==== git merge | |
327 | 309 | |
328 | 310 | The `git merge` tool is used to merge one or more branches into the branch you have checked out. |
329 | 311 | 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 | ||
334 | 316 | |
335 | 317 | -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>>. |
336 | 318 | +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>>. | |
339 | 319 | |
340 | 320 | -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>>. | |
342 | 322 | |
343 | 323 | -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>>. | |
345 | 325 | |
346 | 326 | -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 | |
348 | 330 | |
349 | 331 | The `git mergetool` command simply launches an external merge helper in case you have issues with a merge in Git. |
350 | 332 | |
351 | 333 | -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>>. |
352 | 334 | +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 | |
355 | 335 | |
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 @@ | |
359 | 339 | |
360 | 340 | This command is used in nearly every chapter of the book to demonstrate the history of a project. |
361 | 341 |
@@ -384,15 +364,15 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
384 | 364 | |
385 | 365 | -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. |
386 | 366 | +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 | |
389 | 369 | |
390 | 370 | 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. |
391 | 371 | |
392 | 372 | -This is basically entirely covered in <<ch07-git-tools#r_git_stashing>>. |
393 | 373 | +This is basically entirely covered in <<ch07-git-tools#_git_stashing>>. |
394 | -+ | |
395 | -+==== git tag | |
374 | + | |
375 | + ==== git tag | |
396 | 376 | |
397 | 377 | The `git tag` command is used to give a permanent bookmark to a specific point in the code history. |
398 | 378 | 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 | ||
406 | 386 | |
407 | 387 | === Sharing and Updating Projects |
408 | 388 | |
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 @@ | |
411 | 390 | |
412 | -+==== git fetch | |
413 | -+ | |
414 | 391 | 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. |
415 | 392 | |
416 | 393 | -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>>. |
417 | 394 | +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>>. | |
420 | 395 | |
421 | 396 | -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>>. | |
423 | 398 | |
424 | 399 | -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>>. | |
426 | 401 | |
427 | 402 | -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 | |
429 | 406 | |
430 | 407 | 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. |
431 | 408 | |
432 | 409 | -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>>. |
433 | 410 | +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>>. | |
436 | 411 | |
437 | 412 | -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>>. | |
439 | 414 | |
440 | 415 | -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>>. | |
442 | 417 | |
443 | 418 | -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 | |
445 | 422 | |
446 | 423 | 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. |
447 | 424 | 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 | ||
470 | 447 | +Finally, in <<ch10-git-internals#_pushing_refspecs>> we look at pushing with a full refspec instead of the general shortcuts that are normally used. |
471 | 448 | This can help you be very specific about what work you wish to share. |
472 | 449 | |
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 @@ | |
476 | 452 | 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. |
477 | 453 | You can have several of these and the `git remote` command is used to add, change and delete them. |
478 | 454 |
@@ -481,16 +457,16 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
481 | 457 | |
482 | 458 | It is used in nearly every subsequent chapter in the book too, but always in the standard `git remote add <name> <url>` format. |
483 | 459 | |
484 | -+==== git archive | |
485 | -+ | |
460 | +@@ -330,7 +378,7 @@ | |
461 | + | |
486 | 462 | The `git archive` command is used to create an archive file of a specific snapshot of the project. |
487 | 463 | |
488 | 464 | -We use `git archive` to create a tarball of a project for sharing in <<ch05-distributed-git#r_preparing_release>>. |
489 | 465 | +We use `git archive` to create a tarball of a project for sharing in <<ch05-distributed-git#_preparing_release>>. |
490 | -+ | |
491 | -+==== git submodule | |
492 | 466 | |
493 | - The `git submodule` command is used to manage external repositories within a normal repositories. | |
467 | + ==== git submodule | |
468 | + | |
469 | +@@ -338,7 +386,7 @@ | |
494 | 470 | This could be for libraries or other types of shared resources. |
495 | 471 | The `submodule` command has several sub-commands (`add`, `update`, `sync`, etc) for managing these resources. |
496 | 472 |
@@ -499,8 +475,7 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
499 | 475 | |
500 | 476 | === Inspection and Comparison |
501 | 477 | |
502 | -+==== git show | |
503 | -+ | |
478 | +@@ -347,25 +395,26 @@ | |
504 | 479 | The `git show` command can show a Git object in a simple and human readable way. |
505 | 480 | Normally you would use this to show the information about a tag or a commit. |
506 | 481 |
@@ -512,16 +487,16 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
512 | 487 | |
513 | 488 | -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. |
514 | 489 | +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 | |
517 | 492 | |
518 | 493 | The `git shortlog` command is used to summarize the output of `git log`. |
519 | 494 | 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. |
520 | 495 | |
521 | 496 | -We showed how to use it to create a nice changelog in <<ch05-distributed-git#r_the_shortlog>>. |
522 | 497 | +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 | |
525 | 500 | |
526 | 501 | 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. |
527 | 502 | 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 | ||
532 | 507 | |
533 | 508 | === Debugging |
534 | 509 | |
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 @@ | |
537 | 511 | |
538 | -+==== git bisect | |
539 | -+ | |
540 | 512 | 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. |
541 | 513 | |
542 | 514 | -It is fully covered in <<ch07-git-tools#r_binary_search>> and is only mentioned in that section. |
543 | 515 | +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 | |
546 | 518 | |
547 | 519 | 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. |
548 | 520 | This is helpful in order to find the person to ask for more information about a specific section of your code. |
549 | 521 | |
550 | 522 | -It is covered in <<ch07-git-tools#r_file_annotation>> and is only mentioned in that section. |
551 | 523 | +It is covered in <<ch07-git-tools#_file_annotation>> and is only mentioned in that section. |
552 | -+ | |
553 | -+==== git grep | |
524 | + | |
525 | + ==== git grep | |
554 | 526 | |
555 | 527 | 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. |
556 | 528 |
@@ -559,35 +531,31 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
559 | 531 | |
560 | 532 | === Patching |
561 | 533 | |
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 @@ | |
567 | 535 | 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. |
568 | 536 | 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. |
569 | 537 | |
570 | 538 | -Cherry picking is described and demonstrated in <<ch05-distributed-git#r_rebase_cherry_pick>>. |
571 | 539 | +Cherry picking is described and demonstrated in <<ch05-distributed-git#_rebase_cherry_pick>>. |
572 | -+ | |
573 | -+==== git rebase | |
540 | + | |
541 | + ==== git rebase | |
574 | 542 | |
575 | 543 | The `git rebase` command is basically an automated `cherry-pick`. |
576 | 544 | It determines a series of commits and then cherry-picks them one by one in the same order somewhere else. |
577 | 545 | |
578 | 546 | -Rebasing is covered in detail in <<ch03-git-branching#r_rebasing>>, including covering the collaborative issues involved with rebasing branches that are already public. |
579 | 547 | +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. | |
582 | 548 | |
583 | 549 | -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. | |
585 | 551 | |
586 | 552 | -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>>. | |
588 | 554 | |
589 | 555 | -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 | |
591 | 559 | |
592 | 560 | The `git revert` command is essentially a reverse `git cherry-pick`. |
593 | 561 | 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 | ||
597 | 565 | |
598 | 566 | |
599 | 567 | |
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 @@ | |
605 | 569 | The `git apply` command applies a patch created with the `git diff` or even GNU diff command. |
606 | 570 | It is similar to what the `patch` command might do with a few small differences. |
607 | 571 | |
608 | 572 | -We demonstrate using it and the circumstances in which you might do so in <<ch05-distributed-git#r_patches_from_email>>. |
609 | 573 | +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 | |
612 | 576 | |
613 | 577 | The `git am` command is used to apply patches from an email inbox, specifically one that is mbox formatted. |
614 | 578 | 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 | ||
621 | 585 | |
622 | 586 | -We also use it to apply patch formatted GitHub Pull Request changes in <<ch06-github#r_email_notifications>>. |
623 | 587 | +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 | |
626 | 590 | |
627 | 591 | 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. |
628 | 592 | |
629 | 593 | -We go through an example of contributing to a project using the `git format-patch` tool in <<ch05-distributed-git#r_project_over_email>>. |
630 | 594 | +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 | |
633 | 597 | |
634 | 598 | The `git imap-send` command uploads a mailbox generated with `git format-patch` into an IMAP drafts folder. |
635 | 599 | |
636 | 600 | -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>>. |
637 | 601 | +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 | |
640 | 604 | |
641 | 605 | The `git send-email` command is used to send patches that are generated with `git format-patch` over email. |
642 | 606 | |
643 | 607 | -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>>. |
644 | 608 | +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 | |
647 | 611 | |
648 | 612 | The `git request-pull` command is simply used to generate an example message body to email to someone. |
649 | 613 | 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 | ||
653 | 617 | |
654 | 618 | === External Systems |
655 | 619 | |
656 | - Git comes with a few commands to integrate with other version control systems. | |
657 | - | |
658 | -+==== git svn | |
659 | -+ | |
620 | +@@ -480,13 +529,13 @@ | |
660 | 621 | The `git svn` command is used to communicate with the Subversion version control system as a client. |
661 | 622 | This means you can use Git to checkout from and commit to a Subversion server. |
662 | 623 | |
663 | 624 | -This command is covered in depth in <<ch09-git-and-other-scms#r_git_svn>>. |
664 | 625 | +This command is covered in depth in <<ch09-git-and-other-systems#_git_svn>>. |
665 | -+ | |
666 | -+==== git fast-import | |
626 | + | |
627 | + ==== git fast-import | |
667 | 628 | |
668 | 629 | 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. |
669 | 630 |
@@ -672,34 +633,31 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
672 | 633 | |
673 | 634 | === Administration |
674 | 635 | |
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 @@ | |
679 | 637 | 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. |
680 | 638 | |
681 | 639 | This command normally runs in the background for you, though you can manually run it if you wish. |
682 | 640 | -We go over some examples of this in <<ch10-git-internals#r_git_gc>>. |
683 | 641 | +We go over some examples of this in <<ch10-git-internals#_git_gc>>. |
684 | -+ | |
685 | -+==== git fsck | |
642 | + | |
643 | + ==== git fsck | |
686 | 644 | |
687 | 645 | The `git fsck` command is used to check the internal database for problems or inconsistencies. |
688 | 646 | |
689 | 647 | -We only quickly use this once in <<ch10-git-internals#r_data_recovery>> to search for dangling objects. |
690 | 648 | +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 | |
693 | 651 | |
694 | 652 | 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. |
695 | 653 | |
696 | 654 | -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. |
697 | 655 | +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>>. | |
700 | 656 | |
701 | 657 | -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 | |
703 | 661 | |
704 | 662 | 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. |
705 | 663 |
@@ -726,13 +684,13 @@ diff -au /tmp/C-git-commands.asc.tmp ../../git/progit2/progit2/C-git-commands.as | ||
726 | 684 | 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. |
727 | 685 | We tried to avoid use of them throughout most of the rest of the book. |
728 | 686 | 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 | |
730 | 688 | +++ ../../git/progit2/progit2/LICENSE.asc 2020-06-28 16:44:50.900011670 +0900 |
731 | 689 | @@ -0,0 +1,2 @@ |
732 | 690 | +This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. |
733 | 691 | +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. |
734 | 692 | 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 | |
736 | 694 | +++ ../../git/progit2/progit2/README.asc 2020-09-07 09:33:11.246683703 +0900 |
737 | 695 | @@ -1,51 +1,22 @@ |
738 | 696 | -= Pro Git 第2版 日本語翻訳 |
@@ -818,7 +776,7 @@ diff -au /tmp/README.asc.tmp ../../git/progit2/progit2/README.asc | ||
818 | 776 | -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]. |
819 | 777 | +If you'd like to help out by making a change, take a look at the link:CONTRIBUTING.md[contributor's guide]. |
820 | 778 | 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 | |
822 | 780 | +++ ../../git/progit2/progit2/TRANSLATION_NOTES.asc 2020-06-28 16:44:50.919014468 +0900 |
823 | 781 | @@ -0,0 +1,11 @@ |
824 | 782 | +== Translation Notes |
@@ -833,7 +791,7 @@ diff -au /tmp/TRANSLATION_NOTES.asc.tmp ../../git/progit2/progit2/TRANSLATION_NO | ||
833 | 791 | +As the work is translated, please update the `status.json` file to indicate the rough percentage complete each file is. |
834 | 792 | +This will be shown on various pages to let people know how much work is left to be done. |
835 | 793 | 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 | |
837 | 795 | +++ ../../git/progit2/progit2/book/01-introduction/sections/about-version-control.asc 2020-07-04 16:36:46.718685392 +0900 |
838 | 796 | @@ -1,57 +1,60 @@ |
839 | 797 | === About Version Control |
@@ -912,7 +870,7 @@ diff -au /tmp/book/01-introduction/sections/about-version-control.asc.tmp ../../ | ||
912 | 870 | |
913 | 871 | 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. |
914 | 872 | 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 | |
916 | 874 | +++ ../../git/progit2/progit2/book/01-introduction/sections/command-line.asc 2020-06-28 16:44:50.920014615 +0900 |
917 | 875 | @@ -1,11 +1,11 @@ |
918 | 876 | === The Command Line |
@@ -931,7 +889,7 @@ diff -au /tmp/book/01-introduction/sections/command-line.asc.tmp ../../git/progi | ||
931 | 889 | +So we will expect you to know how to open Terminal in macOS or Command Prompt or PowerShell in Windows. |
932 | 890 | 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. |
933 | 891 | 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 | |
935 | 893 | +++ ../../git/progit2/progit2/book/01-introduction/sections/first-time-setup.asc 2020-08-10 10:02:15.168231103 +0900 |
936 | 894 | @@ -1,4 +1,4 @@ |
937 | 895 | -[[r_first_time]] |
@@ -939,7 +897,7 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p | ||
939 | 897 | === First-Time Git Setup |
940 | 898 | |
941 | 899 | 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 @@ | |
943 | 901 | 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))) |
944 | 902 | These variables can be stored in three different places: |
945 | 903 |
@@ -995,25 +953,27 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p | ||
995 | 953 | |
996 | 954 | 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. |
997 | 955 | 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: | |
999 | 958 | |
1000 | 959 | -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 | |
1006 | 960 | +[source,console] |
1007 | 961 | +---- |
1008 | 962 | +$ git config --global core.editor emacs |
1009 | 963 | +---- |
1010 | -+ | |
964 | + | |
965 | +-On a x86 system | |
1011 | 966 | +On a Windows system, if you want to use a different text editor, you must specify the full path to its executable file. |
1012 | 967 | +This can be different depending on how your editor is packaged. |
1013 | -+ | |
968 | + | |
969 | +-On a x64 system | |
1014 | 970 | +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. |
1015 | 971 | +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 | +-==== | |
1017 | 977 | +[source,console] |
1018 | 978 | +---- |
1019 | 979 | +$ 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 | ||
1021 | 981 | |
1022 | 982 | +[NOTE] |
1023 | 983 | ==== |
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. | |
1026 | 984 | +Vim, Emacs and Notepad++ are popular text editors often used by developers on Unix-based systems like Linux and macOS or a Windows system. |
1027 | 985 | +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>>. |
1028 | 986 | ==== |
@@ -1035,6 +993,8 @@ diff -au /tmp/book/01-introduction/sections/first-time-setup.asc.tmp ../../git/p | ||
1035 | 993 | +An example on a Windows system may include a prematurely terminated Git operation during a Git initiated edit. |
1036 | 994 | ==== |
1037 | 995 | |
996 | +-==== | |
997 | +-==== | |
1038 | 998 | +==== Your default branch name |
1039 | 999 | + |
1040 | 1000 | +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 | ||
1046 | 1006 | +---- |
1047 | 1007 | +$ git config --global init.defaultBranch main |
1048 | 1008 | +---- |
1049 | -+ | |
1009 | + | |
1050 | 1010 | ==== Checking Your Settings |
1051 | 1011 | |
1052 | 1012 | -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 | ||
1088 | 1048 | +---- |
1089 | 1049 | +==== |
1090 | 1050 | 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 | |
1092 | 1052 | +++ ../../git/progit2/progit2/book/01-introduction/sections/help.asc 2020-07-04 16:36:46.718685392 +0900 |
1093 | 1053 | @@ -1,10 +1,48 @@ |
1094 | 1054 | -[[r_git_help]] |
@@ -1144,7 +1104,7 @@ diff -au /tmp/book/01-introduction/sections/help.asc.tmp ../../git/progit2/progi | ||
1144 | 1104 | +---- |
1145 | 1105 | + |
1146 | 1106 | 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 | |
1148 | 1108 | +++ ../../git/progit2/progit2/book/01-introduction/sections/history.asc 2020-06-28 16:44:50.921014763 +0900 |
1149 | 1109 | @@ -17,4 +17,4 @@ |
1150 | 1110 | * 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 | ||
1153 | 1113 | -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>>). |
1154 | 1114 | +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>>). |
1155 | 1115 | 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 | |
1157 | 1117 | +++ ../../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 @@ | |
1159 | 1119 | Even if it's already installed, it's probably a good idea to update to the latest version. |
1160 | 1120 | You can either install it as a package or via another installer, or download the source code and compile it yourself. |
1161 | 1121 |
@@ -1165,6 +1125,9 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2 | ||
1165 | 1125 | +This book was written using Git version *2.8.0*. |
1166 | 1126 | 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. |
1167 | 1127 | -Since Git is quite excellent at preserving backwards compatibility, any version after 2.0 should work just fine. |
1128 | +-==== | |
1129 | +- | |
1130 | +-==== | |
1168 | 1131 | +Since Git is quite excellent at preserving backwards compatibility, any version after 2.8 should work just fine. |
1169 | 1132 | ==== |
1170 | 1133 |
@@ -1175,24 +1138,24 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2 | ||
1175 | 1138 | +(((Linux, installing))) |
1176 | 1139 | +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. |
1177 | 1140 | +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 | ++ | |
1180 | 1142 | +[source,console] |
1181 | 1143 | +---- |
1182 | 1144 | +$ sudo dnf install git-all |
1183 | 1145 | +---- |
1184 | 1146 | |
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: | |
1186 | 1148 | +If you're on a Debian-based distribution, such as Ubuntu, try `apt`: |
1187 | 1149 | |
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[]. | |
1189 | 1151 | +[source,console] |
1190 | 1152 | +---- |
1191 | 1153 | +$ sudo apt install git-all |
1192 | 1154 | +---- |
1193 | 1155 | |
1156 | +-==== Installing on Mac | |
1194 | 1157 | +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 | + | |
1196 | 1159 | +==== Installing on macOS |
1197 | 1160 | + |
1198 | 1161 | +(((macOS, installing))) |
@@ -1231,11 +1194,11 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2 | ||
1231 | 1194 | -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/[]. |
1232 | 1195 | +Just go to https://git-scm.com/download/win[] and the download will start automatically. |
1233 | 1196 | +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. | |
1237 | 1197 | |
1238 | 1198 | -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 | ++ | |
1239 | 1202 | +Another easy way to get Git installed is by installing GitHub Desktop. |
1240 | 1203 | The installer includes a command line version of Git as well as the GUI. |
1241 | 1204 | -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 | ||
1253 | 1216 | -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: |
1254 | 1217 | +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. |
1255 | 1218 | +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 | ++ | |
1258 | 1220 | +[source,console] |
1259 | 1221 | +---- |
1260 | 1222 | +$ 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 | ||
1271 | 1233 | +$ sudo apt-get install asciidoc xmlto docbook2x |
1272 | 1234 | +---- |
1273 | 1235 | |
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): | |
1275 | 1237 | +[NOTE] |
1276 | 1238 | +==== |
1277 | 1239 | +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. |
1278 | 1240 | +==== |
1279 | -+ | |
1241 | + | |
1242 | +-Additionally, if you're using Fedora/RHEL/RHEL-derivatives, you need to do this | |
1280 | 1243 | +If you're using a Debian-based distribution (Debian/Ubuntu/Ubuntu-derivatives), you also need the `install-info` package: |
1281 | 1244 | + |
1282 | 1245 | +[source,console] |
@@ -1325,7 +1288,7 @@ diff -au /tmp/book/01-introduction/sections/installing.asc.tmp ../../git/progit2 | ||
1325 | 1288 | +---- |
1326 | 1289 | Warning: file not found: ../../git/progit2/progit2-ja/book/01-introduction/sections/what-is-git.asc |
1327 | 1290 | 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 | |
1329 | 1292 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/aliases.asc 2020-07-03 19:43:27.508489967 +0900 |
1330 | 1293 | @@ -1,28 +1,70 @@ |
1331 | 1294 | -[[r_git_aliases]] |
@@ -1402,7 +1365,7 @@ diff -au /tmp/book/02-git-basics/sections/aliases.asc.tmp ../../git/progit2/prog | ||
1402 | 1365 | +$ git config --global alias.visual '!gitk' |
1403 | 1366 | +---- |
1404 | 1367 | 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 | |
1406 | 1369 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/getting-a-repository.asc 2020-07-01 10:48:37.610009640 +0900 |
1407 | 1370 | @@ -1,41 +1,87 @@ |
1408 | 1371 | -[[r_getting_a_repo]] |
@@ -1509,7 +1472,7 @@ diff -au /tmp/book/02-git-basics/sections/getting-a-repository.asc.tmp ../../git | ||
1509 | 1472 | -<<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. |
1510 | 1473 | +<<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. |
1511 | 1474 | 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 | |
1513 | 1476 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/recording-changes.asc 2020-07-04 16:36:46.720685416 +0900 |
1514 | 1477 | @@ -1,48 +1,91 @@ |
1515 | 1478 | === Recording Changes to the Repository |
@@ -1737,7 +1700,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr | ||
1737 | 1700 | ==== Ignoring Files |
1738 | 1701 | |
1739 | 1702 | 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 @@ | |
1741 | 1704 | In such cases, you can create a file listing patterns to match them named `.gitignore`.(((ignoring files))) |
1742 | 1705 | Here is an example `.gitignore` file: |
1743 | 1706 |
@@ -1800,15 +1763,15 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr | ||
1800 | 1763 | ==== |
1801 | 1764 | |
1802 | 1765 | +[NOTE] |
1803 | -+==== | |
1766 | + ==== | |
1804 | 1767 | +In the simple case, a repository might have a single `.gitignore` file in its root directory, which applies recursively to the entire repository. |
1805 | 1768 | +However, it is also possible to have additional `.gitignore` files in subdirectories. |
1806 | 1769 | +The rules in these nested `.gitignore` files apply only to the files under the directory where they are located. |
1807 | 1770 | +The Linux kernel source repository has 206 `.gitignore` files. |
1808 | 1771 | + |
1809 | 1772 | +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 | + | |
1812 | 1775 | +[[_git_diff_staged]] |
1813 | 1776 | ==== Viewing Your Staged and Unstaged Changes |
1814 | 1777 |
@@ -1946,10 +1909,13 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr | ||
1946 | 1909 | .Git Diff in an External Tool |
1947 | 1910 | ==== |
1948 | 1911 | 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 @@ | |
1950 | 1913 | Run `git difftool --tool-help` to see what is available on your system. |
1951 | 1914 | ==== |
1952 | 1915 | |
1916 | +-==== | |
1917 | +-==== | |
1918 | +- | |
1953 | 1919 | +[[_committing_changes]] |
1954 | 1920 | ==== Committing Your Changes |
1955 | 1921 |
@@ -2019,7 +1985,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr | ||
2019 | 1985 | Now you've created your first commit! |
2020 | 1986 | 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. |
2021 | 1987 | |
2022 | -@@ -175,25 +476,73 @@ | |
1988 | +@@ -181,25 +476,73 @@ | |
2023 | 1989 | |
2024 | 1990 | ==== Skipping the Staging Area |
2025 | 1991 |
@@ -2095,7 +2061,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr | ||
2095 | 2061 | 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. |
2096 | 2062 | |
2097 | 2063 | 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 @@ | |
2099 | 2065 | 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. |
2100 | 2066 | To do this, use the `--cached` option: |
2101 | 2067 |
@@ -2171,7 +2137,7 @@ diff -au /tmp/book/02-git-basics/sections/recording-changes.asc.tmp ../../git/pr | ||
2171 | 2137 | +The only real difference is that `git mv` is one command instead of three -- it's a convenience function. |
2172 | 2138 | More importantly, you can use any tool you like to rename a file, and address the add/rm later, before you commit. |
2173 | 2139 | 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 | |
2175 | 2141 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/remotes.asc 2020-07-17 09:06:42.261936072 +0900 |
2176 | 2142 | @@ -1,4 +1,4 @@ |
2177 | 2143 | -[[r_remote_repos]] |
@@ -2432,7 +2398,7 @@ diff -au /tmp/book/02-git-basics/sections/remotes.asc.tmp ../../git/progit2/prog | ||
2432 | 2398 | + |
2433 | 2399 | +Once you delete the reference to a remote this way, all remote-tracking branches and configuration settings associated with that remote are also deleted. |
2434 | 2400 | 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 | |
2436 | 2402 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/tagging.asc 2020-08-29 09:58:24.048195629 +0900 |
2437 | 2403 | @@ -1,77 +1,299 @@ |
2438 | 2404 | -[[r_git_tagging]] |
@@ -2753,7 +2719,7 @@ diff -au /tmp/book/02-git-basics/sections/tagging.asc.tmp ../../git/progit2/prog | ||
2753 | 2719 | -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. |
2754 | 2720 | +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. |
2755 | 2721 | 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 | |
2757 | 2723 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/undoing.asc 2020-10-18 09:42:35.779991668 +0900 |
2758 | 2724 | @@ -1,4 +1,4 @@ |
2759 | 2725 | -[[r_undoing]] |
@@ -2775,7 +2741,7 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog | ||
2775 | 2741 | |
2776 | 2742 | This command takes your staging area and uses it for the commit. |
2777 | 2743 | 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 @@ | |
2779 | 2745 | |
2780 | 2746 | 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: |
2781 | 2747 |
@@ -2855,6 +2821,9 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog | ||
2855 | 2821 | ===== |
2856 | 2822 | -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. |
2857 | 2823 | -Calling `git reset` without an option is not dangerous - it only touches your staging area. |
2824 | +-===== | |
2825 | +- | |
2826 | +-===== | |
2858 | 2827 | +It's true that `git reset` can be a dangerous command, especially if you provide the `--hard` flag. |
2859 | 2828 | +However, in the scenario described above, the file in your working directory is not touched, so it's relatively safe. |
2860 | 2829 | ===== |
@@ -2902,6 +2871,9 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog | ||
2902 | 2871 | It's important to understand that `git checkout -- <file>` is a dangerous command. |
2903 | 2872 | -Any changes you made to that file are gone – you just copied another file over it. |
2904 | 2873 | -Don't ever use this command unless you absolutely know that you don't want the file. |
2874 | +-===== | |
2875 | +- | |
2876 | +-===== | |
2905 | 2877 | +Any local changes you made to that file are gone -- Git just replaced that file with the most recently-committed version. |
2906 | 2878 | +Don't ever use this command unless you absolutely know that you don't want those unsaved local changes. |
2907 | 2879 | ===== |
@@ -3000,7 +2972,7 @@ diff -au /tmp/book/02-git-basics/sections/undoing.asc.tmp ../../git/progit2/prog | ||
3000 | 2972 | +Don't ever use this command unless you absolutely know that you don't want those unsaved local changes. |
3001 | 2973 | +===== |
3002 | 2974 | 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 | |
3004 | 2976 | +++ ../../git/progit2/progit2/book/02-git-basics/sections/viewing-history.asc 2020-09-26 08:56:07.950296410 +0900 |
3005 | 2977 | @@ -1,76 +1,213 @@ |
3006 | 2978 | -[[r_viewing_history]] |
@@ -3350,7 +3322,7 @@ diff -au /tmp/book/02-git-basics/sections/viewing-history.asc.tmp ../../git/prog | ||
3350 | 3322 | +To prevent the display of merge commits cluttering up your log history, simply add the log option `--no-merges`. |
3351 | 3323 | +==== |
3352 | 3324 | 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 | |
3354 | 3326 | +++ ../../git/progit2/progit2/book/03-git-branching/sections/basic-branching-and-merging.asc 2020-07-04 16:36:46.720685416 +0900 |
3355 | 3327 | @@ -3,8 +3,8 @@ |
3356 | 3328 | 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 | ||
3363 | 3335 | . Do some work in that branch. |
3364 | 3336 | |
3365 | 3337 | 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 @@ | |
3367 | 3339 | . Switch to your production branch. |
3368 | 3340 | . Create a branch to add the hotfix. |
3369 | 3341 | . 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 | ||
3414 | 3386 | +$ vim index.html |
3415 | 3387 | +$ git commit -a -m 'Create new footer [issue 53]' |
3416 | 3388 | +---- |
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] | |
3420 | 3389 | |
3421 | 3390 | -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 | ++ | |
3422 | 3394 | +Now you get the call that there is an issue with the website, and you need to fix it immediately. |
3423 | 3395 | 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. |
3424 | 3396 | 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 | ||
3553 | 3525 | Now that your work is merged in, you have no further need for the `iss53` branch. |
3554 | 3526 | -You can close the ticket in your ticket-tracking system, and delete the branch: |
3555 | 3527 | +You can close the issue in your issue-tracking system, and delete the branch: |
3556 | -+ | |
3528 | + | |
3557 | 3529 | +[source,console] |
3558 | 3530 | +---- |
3559 | 3531 | +$ git branch -d iss53 |
3560 | 3532 | +---- |
3561 | - | |
3533 | ++ | |
3562 | 3534 | +[[_basic_merge_conflicts]] |
3563 | 3535 | ==== Basic Merge Conflicts |
3564 | 3536 |
@@ -3604,7 +3576,7 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp | ||
3604 | 3576 | +---- |
3605 | 3577 | +<<<<<<< HEAD:index.html |
3606 | 3578 | +<div id="footer">contact : email.support@github.com</div> |
3607 | -+======= | |
3579 | + ======= | |
3608 | 3580 | +<div id="footer"> |
3609 | 3581 | + please contact us at support@github.com |
3610 | 3582 | +</div> |
@@ -3652,6 +3624,9 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp | ||
3652 | 3624 | +[NOTE] |
3653 | 3625 | ==== |
3654 | 3626 | -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 | +-==== | |
3655 | 3630 | +If you need more advanced tools for resolving tricky merge conflicts, we cover more on merging in <<ch07-git-tools#_advanced_merging>>. |
3656 | 3631 | ==== |
3657 | 3632 |
@@ -3700,7 +3675,7 @@ diff -au /tmp/book/03-git-branching/sections/basic-branching-and-merging.asc.tmp | ||
3700 | 3675 | + |
3701 | 3676 | +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. |
3702 | 3677 | 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 | |
3704 | 3679 | +++ ../../git/progit2/progit2/book/03-git-branching/sections/branch-management.asc 2020-09-12 09:27:13.221663700 +0900 |
3705 | 3680 | @@ -1,4 +1,4 @@ |
3706 | 3681 | -[[r_branch_management]] |
@@ -3848,9 +3823,9 @@ diff -au /tmp/book/03-git-branching/sections/branch-management.asc.tmp ../../git | ||
3848 | 3823 | +$ git push origin --delete master |
3849 | 3824 | +---- |
3850 | 3825 | 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 | |
3852 | 3827 | +++ ../../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 @@ | |
3854 | 3829 | -[[r_git_branches_overview]] |
3855 | 3830 | +[[_git_branches_overview]] |
3856 | 3831 | === Branches in a Nutshell |
@@ -3901,9 +3876,12 @@ diff -au /tmp/book/03-git-branching/sections/nutshell.asc.tmp ../../git/progit2/ | ||
3901 | 3876 | ==== |
3902 | 3877 | The ``master'' branch in Git is not a special branch.(((master))) |
3903 | 3878 | 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. | |
3905 | 3880 | ==== |
3906 | 3881 | |
3882 | +-==== | |
3883 | +-==== | |
3884 | +- | |
3907 | 3885 | .A branch and its commit history |
3908 | 3886 | -image::images/branch-and-history.png[A branch and its commit history.] |
3909 | 3887 | +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/ | ||
4020 | 3998 | .Switching branches changes files in your working directory |
4021 | 3999 | ==== |
4022 | 4000 | 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 | + ==== | |
4024 | 4004 | |
4005 | +-==== | |
4006 | +-==== | |
4007 | +- | |
4025 | 4008 | Let's make a few changes and commit again: |
4026 | 4009 | |
4027 | 4010 | -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/ | ||
4060 | 4043 | Creating a new branch is as quick and simple as writing 41 bytes to a file (40 characters and a newline). |
4061 | 4044 | |
4062 | 4045 | 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 @@ | |
4064 | 4047 | These features help encourage developers to create and use branches often. |
4065 | 4048 | |
4066 | 4049 | 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/ | ||
4080 | 4063 | +- Return to your previously checked out branch: `git switch -`. |
4081 | 4064 | +==== |
4082 | 4065 | 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 | |
4084 | 4067 | +++ ../../git/progit2/progit2/book/03-git-branching/sections/rebasing.asc 2020-08-17 16:38:51.075694960 +0900 |
4085 | 4068 | @@ -1,94 +1,144 @@ |
4086 | 4069 | -[[r_rebasing]] |
@@ -4342,7 +4325,7 @@ diff -au /tmp/book/03-git-branching/sections/rebasing.asc.tmp ../../git/progit2/ | ||
4342 | 4325 | -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. |
4343 | 4326 | +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. |
4344 | 4327 | 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 | |
4346 | 4329 | +++ ../../git/progit2/progit2/book/03-git-branching/sections/remote-branches.asc 2020-07-04 16:36:46.723685453 +0900 |
4347 | 4330 | @@ -1,23 +1,25 @@ |
4348 | 4331 | -[[r_remote_branches]] |
@@ -4376,7 +4359,14 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p | ||
4376 | 4359 | .``origin'' is not special |
4377 | 4360 | ==== |
4378 | 4361 | 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 | |
4380 | 4370 | image::images/remote-branches-1.png[Server and local repositories after cloning.] |
4381 | 4371 | |
4382 | 4372 | 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 | ||
4452 | 4442 | .Don't type your password every time |
4453 | 4443 | ==== |
4454 | 4444 | 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 @@ | |
4456 | 4446 | If you don't want to type it every single time you push, you can set up a ``credential cache''. |
4457 | 4447 | 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`. |
4458 | 4448 | |
4459 | 4449 | -For more information on the various credential caching options available, see <<ch07-git-tools#r_credential_caching>>. |
4450 | +-==== | |
4451 | +- | |
4452 | +-==== | |
4460 | 4453 | +For more information on the various credential caching options available, see <<ch07-git-tools#_credential_caching>>. |
4461 | 4454 | ==== |
4462 | 4455 |
@@ -4548,7 +4541,12 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p | ||
4548 | 4541 | .Upstream shorthand |
4549 | 4542 | ==== |
4550 | 4543 | 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 | +- | |
4552 | 4550 | If you want to see what tracking branches you have set up, you can use the `-vv` option to `git branch`. |
4553 | 4551 | 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. |
4554 | 4552 |
@@ -4564,7 +4562,7 @@ diff -au /tmp/book/03-git-branching/sections/remote-branches.asc.tmp ../../git/p | ||
4564 | 4562 | 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. |
4565 | 4563 | We can also see that our `master` branch is tracking `origin/master` and is up to date. |
4566 | 4564 | 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 @@ | |
4568 | 4566 | It's important to note that these numbers are only since the last time you fetched from each server. |
4569 | 4567 | This command does not reach out to the servers, it's telling you about what it has cached from these servers locally. |
4570 | 4568 | 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 | ||
4606 | 4604 | Basically all this does is remove the pointer from the server. |
4607 | 4605 | 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. |
4608 | 4606 | 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 | |
4610 | 4608 | +++ ../../git/progit2/progit2/book/03-git-branching/sections/workflows.asc 2020-07-04 16:36:46.723685453 +0900 |
4611 | 4609 | @@ -1,35 +1,39 @@ |
4612 | 4610 | === Branching Workflows |
@@ -4682,7 +4680,7 @@ diff -au /tmp/book/03-git-branching/sections/workflows.asc.tmp ../../git/progit2 | ||
4682 | 4680 | -When you're branching and merging, everything is being done only in your Git repository – no server communication is happening. |
4683 | 4681 | +When you're branching and merging, everything is being done only in your Git repository -- there is no communication with the server. |
4684 | 4682 | 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 | |
4686 | 4684 | +++ ../../git/progit2/progit2/book/04-git-server/sections/generating-ssh-key.asc 2020-08-05 13:56:11.288918669 +0900 |
4687 | 4685 | @@ -1,21 +1,57 @@ |
4688 | 4686 | -[[r_generate_ssh_key]] |
@@ -4748,7 +4746,7 @@ diff -au /tmp/book/04-git-server/sections/generating-ssh-key.asc.tmp ../../git/p | ||
4748 | 4746 | + |
4749 | 4747 | +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[]. |
4750 | 4748 | 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 | |
4752 | 4750 | +++ ../../git/progit2/progit2/book/04-git-server/sections/git-daemon.asc 2020-06-28 16:44:50.925015352 +0900 |
4753 | 4751 | @@ -1,33 +1,66 @@ |
4754 | 4752 | === Git Daemon |
@@ -4831,9 +4829,9 @@ diff -au /tmp/book/04-git-server/sections/git-daemon.asc.tmp ../../git/progit2/p | ||
4831 | 4829 | + |
4832 | 4830 | The presence of that file tells Git that it's OK to serve this project without authentication. |
4833 | 4831 | 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 | |
4835 | 4833 | +++ ../../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 @@ | |
4837 | 4835 | -[[r_git_on_the_server]] |
4838 | 4836 | +[[_getting_git_on_a_server]] |
4839 | 4837 | === 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 | ||
4847 | 4845 | 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. |
4848 | 4846 | ==== |
4849 | 4847 | |
4848 | +-==== | |
4849 | +-==== | |
4850 | +- | |
4850 | 4851 | -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. |
4851 | 4852 | +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. |
4852 | 4853 | 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 | ||
4865 | 4866 | |
4866 | 4867 | -This is roughly equivalent to something like |
4867 | 4868 | +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. | |
4869 | 4871 | +[source,console] |
4870 | 4872 | +---- |
4871 | 4873 | +$ cp -Rf my_project/.git my_project.git |
4872 | 4874 | +---- |
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 | ++ | |
4875 | 4876 | +There are a couple of minor differences in the configuration file but, for your purpose, this is close to the same thing. |
4876 | 4877 | It takes the Git repository by itself, without a working directory, and creates a directory specifically for it alone. |
4877 | 4878 |
@@ -4923,7 +4924,7 @@ diff -au /tmp/book/04-git-server/sections/git-on-a-server.asc.tmp ../../git/prog | ||
4923 | 4924 | |
4924 | 4925 | In the next few sections, you'll see how to expand to more sophisticated setups. |
4925 | 4926 | 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 @@ | |
4927 | 4928 | |
4928 | 4929 | 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. |
4929 | 4930 | 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 | ||
4956 | 4957 | 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. |
4957 | 4958 | As long as each user can get shell access on the machine, any SSH authentication mechanism you can think of should work. |
4958 | 4959 | 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 | |
4960 | 4961 | +++ ../../git/progit2/progit2/book/04-git-server/sections/gitlab.asc 2020-09-07 09:33:11.247683703 +0900 |
4961 | 4962 | @@ -2,60 +2,63 @@ |
4962 | 4963 |
@@ -5134,7 +5135,7 @@ diff -au /tmp/book/04-git-server/sections/gitlab.asc.tmp ../../git/progit2/progi | ||
5134 | 5135 | -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. |
5135 | 5136 | +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. |
5136 | 5137 | 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 | |
5138 | 5139 | +++ ../../git/progit2/progit2/book/04-git-server/sections/gitweb.asc 2020-07-04 16:36:46.723685453 +0900 |
5139 | 5140 | @@ -4,25 +4,67 @@ |
5140 | 5141 | 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 | ||
5209 | 5210 | 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. |
5210 | 5211 | At this point, you should be able to visit `http://gitserver/` to view your repositories online. |
5211 | 5212 | 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 | |
5213 | 5214 | +++ ../../git/progit2/progit2/book/04-git-server/sections/hosted.asc 2020-07-04 16:36:46.725685477 +0900 |
5214 | 5215 | @@ -5,6 +5,6 @@ |
5215 | 5216 | 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 | ||
5220 | 5221 | |
5221 | 5222 | 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. |
5222 | 5223 | 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 | |
5224 | 5225 | +++ ../../git/progit2/progit2/book/04-git-server/sections/protocols.asc 2020-07-04 16:36:46.726685489 +0900 |
5225 | 5226 | @@ -1,39 +1,55 @@ |
5226 | 5227 | === The Protocols |
@@ -5287,7 +5288,7 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr | ||
5287 | 5288 | |
5288 | 5289 | ===== The Cons |
5289 | 5290 | |
5290 | -@@ -45,39 +61,59 @@ | |
5291 | +@@ -45,43 +61,59 @@ | |
5291 | 5292 | 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. |
5292 | 5293 | |
5293 | 5294 | 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 | ||
5308 | 5309 | +The newer version is often referred to as the _Smart_ HTTP protocol and the older way as _Dumb_ HTTP. |
5309 | 5310 | +We'll cover the newer Smart HTTP protocol first. |
5310 | 5311 | |
5312 | + ===== Smart HTTP | |
5313 | + | |
5311 | 5314 | -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 | -+ | |
5314 | 5315 | +(((protocols, smart HTTP))) |
5315 | 5316 | +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. |
5316 | 5317 |
@@ -5321,8 +5322,8 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr | ||
5321 | 5322 | |
5322 | 5323 | -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. |
5323 | 5324 | +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 | |
5326 | 5327 | |
5327 | 5328 | -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. |
5328 | 5329 | +(((protocols, dumb HTTP))) |
@@ -5348,20 +5349,20 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr | ||
5348 | 5349 | 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. |
5349 | 5350 | -This command is run when you push to this repository (over SSH perhaps); then, other people can clone via something like |
5350 | 5351 | +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). | |
5352 | 5355 | +[source,console] |
5353 | 5356 | +---- |
5354 | 5357 | +$ git clone https://example.com/gitproject.git |
5355 | 5358 | +---- |
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 | ++ | |
5359 | 5360 | +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. |
5360 | 5361 | +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). |
5361 | 5362 | |
5362 | 5363 | 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. |
5363 | 5364 | It's rare to run a mix of the two services. |
5364 | -@@ -93,57 +129,69 @@ | |
5365 | +@@ -97,57 +129,69 @@ | |
5365 | 5366 | |
5366 | 5367 | 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. |
5367 | 5368 |
@@ -5389,10 +5390,10 @@ diff -au /tmp/book/04-git-server/sections/protocols.asc.tmp ../../git/progit2/pr | ||
5389 | 5390 | -SSH is also an authenticated network protocol; and because it's ubiquitous, it's generally easy to set up and use. |
5390 | 5391 | +This is because SSH access to servers is already set up in most places -- and if it isn't, it's easy to do. |
5391 | 5392 | +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: | |
5392 | 5395 | |
5393 | 5396 | -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 | -+ | |
5396 | 5397 | +[source,console] |
5397 | 5398 | +---- |
5398 | 5399 | +$ 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 | ||
5451 | 5452 | It uses the same data-transfer mechanism as the SSH protocol but without the encryption and authentication overhead. |
5452 | 5453 | |
5453 | 5454 | ===== The Cons |
5454 | -@@ -152,6 +200,6 @@ | |
5455 | +@@ -156,6 +200,6 @@ | |
5455 | 5456 | It's generally undesirable for the Git protocol to be the only access to your project. |
5456 | 5457 | 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. |
5457 | 5458 | 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 | ||
5460 | 5461 | It also requires firewall access to port 9418, which isn't a standard port that corporate firewalls always allow. |
5461 | 5462 | Behind big corporate firewalls, this obscure port is commonly blocked. |
5462 | 5463 | 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 | |
5464 | 5465 | +++ ../../git/progit2/progit2/book/04-git-server/sections/setting-up-server.asc 2020-06-28 16:44:50.927015646 +0900 |
5465 | 5466 | @@ -1,41 +1,148 @@ |
5466 | 5467 | -[[r_setting_up_server]] |
@@ -5622,7 +5623,7 @@ diff -au /tmp/book/04-git-server/sections/setting-up-server.asc.tmp ../../git/pr | ||
5622 | 5623 | 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. |
5623 | 5624 | 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. |
5624 | 5625 | 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 | |
5626 | 5627 | +++ ../../git/progit2/progit2/book/04-git-server/sections/smart-http.asc 2020-06-28 16:44:50.927015646 +0900 |
5627 | 5628 | @@ -1,28 +1,62 @@ |
5628 | 5629 | === Smart HTTP |
@@ -5702,7 +5703,7 @@ diff -au /tmp/book/04-git-server/sections/smart-http.asc.tmp ../../git/progit2/p | ||
5702 | 5703 | +For more information on configuring authentication in Apache, check out the Apache docs here: https://httpd.apache.org/docs/current/howto/auth.html[] |
5703 | 5704 | ==== |
5704 | 5705 | 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 | |
5706 | 5707 | +++ ../../git/progit2/progit2/book/05-distributed-git/sections/contributing.asc 2020-08-29 09:58:24.050195768 +0900 |
5707 | 5708 | @@ -1,11 +1,12 @@ |
5708 | 5709 | -[[r_contributing_project]] |
@@ -6153,7 +6154,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr | ||
6153 | 6154 | ---- |
6154 | 6155 | # Jessica's Machine |
6155 | 6156 | $ git fetch origin |
6156 | -@@ -269,120 +374,254 @@ | |
6157 | +@@ -269,123 +374,254 @@ | |
6157 | 6158 | |
6158 | 6159 | Now, Jessica makes a couple of commits on the `featureB` branch: |
6159 | 6160 |
@@ -6315,6 +6316,9 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr | ||
6315 | 6316 | 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. |
6316 | 6317 | The sequence looks basically like this: |
6317 | 6318 | |
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 | +-==== | |
6318 | 6322 | +[source,console] |
6319 | 6323 | +---- |
6320 | 6324 | +$ git clone <url> |
@@ -6325,10 +6329,9 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr | ||
6325 | 6329 | + ... work ... |
6326 | 6330 | +$ git commit |
6327 | 6331 | +---- |
6328 | -+ | |
6332 | + | |
6329 | 6333 | +[NOTE] |
6330 | 6334 | ==== |
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. | |
6332 | 6335 | +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. |
6333 | 6336 | ==== |
6334 | 6337 |
@@ -6347,11 +6350,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr | ||
6347 | 6350 | +If the maintainers `merge`, `rebase`, or `cherry-pick` your work, you'll eventually get it back via pulling from their repository anyhow. |
6348 | 6351 | + |
6349 | 6352 | +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 | ++ | |
6355 | 6354 | +[source,console] |
6356 | 6355 | +---- |
6357 | 6356 | +$ git push -u myfork featureA |
@@ -6370,24 +6369,28 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr | ||
6370 | 6369 | +The following changes since commit 1edee6b1d61823a2de3b09c160d7080b8d1b3a40: |
6371 | 6370 | +Jessica Smith (1): |
6372 | 6371 | + 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 | ++ | |
6376 | 6373 | +are available in the git repository at: |
6377 | 6374 | |
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: | |
6380 | 6379 | + git://githost/simplegit.git featureA |
6381 | 6380 | |
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. | |
6383 | 6383 | +Jessica Smith (2): |
6384 | 6384 | + Add limit to log function |
6385 | 6385 | + 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: | |
6387 | 6389 | + lib/simplegit.rb | 10 +++++++++- |
6388 | 6390 | + 1 files changed, 9 insertions(+), 1 deletions(-) |
6389 | 6391 | +---- |
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. | |
6391 | 6394 | +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. |
6392 | 6395 | |
6393 | 6396 | 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 | ||
6426 | 6429 | +$ git rebase origin/master |
6427 | 6430 | +$ git push -f myfork featureA |
6428 | 6431 | +---- |
6432 | ++ | |
6433 | ++This rewrites your history to now look like <<psp_b>>. | |
6429 | 6434 | |
6430 | 6435 | -.Commit history after `featureA` work. |
6431 | 6436 | -image::images/public-small-2.png[Commit history after `featureA` work.] |
6432 | -+This rewrites your history to now look like <<psp_b>>. | |
6433 | -+ | |
6434 | 6437 | +[[psp_b]] |
6435 | 6438 | +.Commit history after `featureA` work |
6436 | 6439 | +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 | ||
6453 | 6456 | $ git commit |
6454 | 6457 | $ git push myfork featureBv2 |
6455 | 6458 | ---- |
6456 | -@@ -391,61 +630,173 @@ | |
6459 | +@@ -394,61 +630,173 @@ | |
6457 | 6460 | 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. |
6458 | 6461 | Also the `--no-commit` option can be useful to delay the merge commit in case of the default merge process. |
6459 | 6462 |
@@ -6638,7 +6641,7 @@ diff -au /tmp/book/05-distributed-git/sections/contributing.asc.tmp ../../git/pr | ||
6638 | 6641 | Next, you'll see how to work the other side of the coin: maintaining a Git project. |
6639 | 6642 | You'll learn how to be a benevolent dictator or integration manager. |
6640 | 6643 | 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 | |
6642 | 6645 | +++ ../../git/progit2/progit2/book/05-distributed-git/sections/distributed-workflows.asc 2020-07-04 16:36:46.728685513 +0900 |
6643 | 6646 | @@ -1,19 +1,21 @@ |
6644 | 6647 | === Distributed Workflows |
@@ -6761,7 +6764,7 @@ diff -au /tmp/book/05-distributed-git/sections/distributed-workflows.asc.tmp ../ | ||
6761 | 6764 | |
6762 | 6765 | 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. |
6763 | 6766 | 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 | |
6765 | 6768 | +++ ../../git/progit2/progit2/book/05-distributed-git/sections/maintaining.asc 2020-07-07 09:30:48.190756402 +0900 |
6766 | 6769 | @@ -1,64 +1,122 @@ |
6767 | 6770 | === Maintaining a Project |
@@ -7048,7 +7051,7 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro | ||
7048 | 7051 | This command gives you a diff, but it may be misleading. |
7049 | 7052 | If your `master` branch has moved forward since you created the topic branch from it, then you'll get seemingly strange results. |
7050 | 7053 | 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 @@ | |
7052 | 7055 | |
7053 | 7056 | 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. |
7054 | 7057 |
@@ -7067,8 +7070,7 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro | ||
7067 | 7070 | +36c7dba2c95e6bbb78dfa822519ecfec6e1ca649 |
7068 | 7071 | +$ git diff 36c7db |
7069 | 7072 | +---- |
7070 | - | |
7071 | --This command shows you only the work your current topic branch has introduced since its common ancestor with master. | |
7073 | ++ | |
7072 | 7074 | +or, more concisely: |
7073 | 7075 | + |
7074 | 7076 | +[source,console] |
@@ -7078,7 +7080,8 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro | ||
7078 | 7080 | + |
7079 | 7081 | +However, neither of those is particularly convenient, so Git provides another shorthand for doing the same thing: the triple-dot syntax. |
7080 | 7082 | +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. | |
7082 | 7085 | +[source,console] |
7083 | 7086 | +---- |
7084 | 7087 | +$ git diff master...contrib |
@@ -7103,17 +7106,17 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro | ||
7103 | 7106 | -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. |
7104 | 7107 | -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>>. |
7105 | 7108 | +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>>. | |
7108 | 7109 | |
7109 | 7110 | -.History with several topic branches. |
7110 | 7111 | -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>>. | |
7114 | 7113 | |
7115 | 7114 | -.After a topic branch merge. |
7116 | 7115 | -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 | ++ | |
7117 | 7120 | +[[merwf_b]] |
7118 | 7121 | +.After a topic branch merge |
7119 | 7122 | +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 | ||
7130 | 7133 | - |
7131 | 7134 | -.After a topic branch merge. |
7132 | 7135 | -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.] | |
7136 | 7136 | +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>>). |
7137 | 7137 | |
7138 | +-.After a project release. | |
7139 | +-image::images/merging-workflows-5.png[After a topic branch release.] | |
7140 | +- | |
7138 | 7141 | -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. |
7139 | 7142 | -You can also continue this concept, having an integrate branch where all the work is merged together. |
7140 | 7143 | -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 | ||
7166 | 7169 | |
7167 | 7170 | -.Managing a complex series of parallel contributed topic branches. |
7168 | 7171 | -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: | |
7169 | 7176 | +[[merwf_f]] |
7170 | 7177 | +.Managing a complex series of parallel contributed topic branches |
7171 | 7178 | +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 | ||
7175 | 7182 | +The `next` and `seen` branches are then rebuilt from the `master`. |
7176 | 7183 | +This means `master` almost always moves forward, `next` is rebased occasionally, and `seen` is rebased even more often: |
7177 | 7184 | |
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 | -- | |
7182 | 7185 | -.Merging contributed topic branches into long-term integration branches. |
7183 | 7186 | -image::images/large-merges-2.png[Merging contributed topic branches into long-term integration branches.] |
7184 | 7187 | +.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 | ||
7234 | 7237 | |
7235 | 7238 | Now you can remove your topic branch and drop the commits you didn't want to pull in. |
7236 | 7239 | |
7237 | -+===== Rerere | |
7238 | -+ | |
7240 | + ===== Rerere | |
7241 | + | |
7239 | 7242 | +(((git commands, rerere)))(((rerere))) |
7240 | 7243 | 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. |
7241 | 7244 |
@@ -7396,9 +7399,9 @@ diff -au /tmp/book/05-distributed-git/sections/maintaining.asc.tmp ../../git/pro | ||
7396 | 7399 | + |
7397 | 7400 | You get a clean summary of all the commits since v1.0.1, grouped by author, that you can email to your list. |
7398 | 7401 | 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 | |
7400 | 7403 | +++ ../../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 @@ | |
7402 | 7405 | === Account Setup and Configuration |
7403 | 7406 | |
7404 | 7407 | +(((GitHub, user accounts))) |
@@ -7419,14 +7422,16 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro | ||
7419 | 7422 | ==== |
7420 | 7423 | -GitHub provides all of its functionality with free accounts, with the limitation that all of your projects are fully public (everyone has read access). |
7421 | 7424 | -GitHub's paid plans include a set number of private projects, but we won't be covering those in this book. |
7425 | +-==== | |
7422 | 7426 | +GitHub provides almost all of its functionality with free accounts, except some advanced features. |
7423 | -+ | |
7427 | + | |
7428 | +-==== | |
7424 | 7429 | +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. |
7425 | 7430 | +To get more information about available plans and their comparison, visit https://github.com/pricing[]. |
7426 | 7431 | ==== |
7427 | 7432 | |
7428 | 7433 | 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 @@ | |
7430 | 7435 | |
7431 | 7436 | ==== SSH Access |
7432 | 7437 |
@@ -7459,6 +7464,9 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro | ||
7459 | 7464 | 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. |
7460 | 7465 | ==== |
7461 | 7466 | |
7467 | +-==== | |
7468 | +-==== | |
7469 | +- | |
7462 | 7470 | +[[_personal_avatar]] |
7463 | 7471 | ==== Your Avatar |
7464 | 7472 |
@@ -7478,7 +7486,7 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro | ||
7478 | 7486 | |
7479 | 7487 | Now anywhere you interact on the site, people will see your avatar next to your username. |
7480 | 7488 | |
7481 | -@@ -64,10 +71,11 @@ | |
7489 | +@@ -70,10 +71,11 @@ | |
7482 | 7490 | The way that GitHub maps your Git commits to your user is by email address. |
7483 | 7491 | 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. |
7484 | 7492 |
@@ -7493,9 +7501,9 @@ diff -au /tmp/book/06-github/sections/1-setting-up-account.asc.tmp ../../git/pro | ||
7493 | 7501 | The second address is verified and so can be set as the primary if you wish to switch them. |
7494 | 7502 | The final address is unverified, meaning that you can't make it your primary address. |
7495 | 7503 | 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 | |
7497 | 7505 | +++ ../../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 @@ | |
7499 | 7507 | |
7500 | 7508 | ==== Forking Projects |
7501 | 7509 |
@@ -7511,6 +7519,9 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p | ||
7511 | 7519 | 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. |
7512 | 7520 | ==== |
7513 | 7521 | |
7522 | +-==== | |
7523 | +-==== | |
7524 | +- | |
7514 | 7525 | -This way, projects don’t have to worry about adding users as collaborators to give them push access. |
7515 | 7526 | +This way, projects don't have to worry about adding users as collaborators to give them push access. |
7516 | 7527 | 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 | ||
7525 | 7536 | |
7526 | 7537 | After a few seconds, you'll be taken to your new project page, with your own writeable copy of the code. |
7527 | 7538 | |
7528 | -+ | |
7539 | +-==== The GitHub Flow | |
7540 | + | |
7541 | +-==== GitHub Flow | |
7529 | 7542 | +[[ch06-github_flow]] |
7530 | - ==== The GitHub Flow | |
7543 | ++==== The GitHub Flow | |
7531 | 7544 | |
7532 | 7545 | +(((GitHub, Flow))) |
7533 | 7546 | 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 | ||
7650 | 7663 | If we click that green button, we'll see a screen that asks us to give our Pull Request a title and description. |
7651 | 7664 | 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. |
7652 | 7665 | |
7653 | -@@ -80,50 +139,69 @@ | |
7666 | +@@ -85,56 +139,69 @@ | |
7654 | 7667 | |
7655 | 7668 | 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. |
7656 | 7669 | |
7657 | 7670 | +[NOTE] |
7658 | 7671 | ==== |
7659 | 7672 | -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 | +-==== | |
7660 | 7676 | +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. |
7661 | 7677 | +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. |
7662 | 7678 | ==== |
@@ -7726,22 +7742,25 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p | ||
7726 | 7742 | .Not Only Forks |
7727 | 7743 | ==== |
7728 | 7744 | -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 | +-==== | |
7729 | 7748 | +It's important to note that you can also open a Pull Request between two branches in the same repository. |
7730 | 7749 | +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. |
7731 | 7750 | +No forking necessary. |
7732 | 7751 | ==== |
7733 | 7752 | |
7734 | 7753 | ==== Advanced Pull Requests |
7735 | -@@ -132,151 +210,339 @@ | |
7754 | +@@ -143,158 +210,339 @@ | |
7736 | 7755 | |
7737 | 7756 | ===== Pull Requests as Patches |
7738 | 7757 | |
7739 | 7758 | -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. | |
7742 | 7759 | +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. |
7743 | 7760 | +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. |
7744 | 7761 | |
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 | +- | |
7745 | 7764 | -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. |
7746 | 7765 | +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. |
7747 | 7766 | +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 | ||
7841 | 7860 | ===== References |
7842 | 7861 | |
7843 | 7862 | -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. | |
7844 | 7865 | +Your next question may be ``How do I reference the old Pull Request?''. |
7845 | 7866 | +It turns out there are many, many ways to reference other things almost anywhere you can write in GitHub. |
7846 | 7867 | |
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>>. | |
7848 | 7869 | +Let's start with how to cross-reference another Pull Request or an Issue. |
7849 | 7870 | +All Pull Requests and Issues are assigned numbers and they are unique within the project. |
7850 | 7871 | +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 | ||
7856 | 7877 | +We also want to reference an issue in the fork of the repository and an issue in a completely different project. |
7857 | 7878 | +We can fill out the description just like <<_pr_references>>. |
7858 | 7879 | |
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 | -- | |
7861 | 7880 | -.Cross references in a Pull Request. |
7862 | 7881 | +[[_pr_references]] |
7863 | 7882 | +.Cross references in a Pull Request |
@@ -7891,14 +7910,16 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p | ||
7891 | 7910 | -==== Markdown |
7892 | 7911 | +==== GitHub Flavored Markdown |
7893 | 7912 | |
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 | |
7895 | 7914 | +Linking to other Issues is just the beginning of interesting things you can do with almost any text box on GitHub. |
7896 | 7915 | +In Issue and Pull Request descriptions, comments, code comments and more, you can use what is called ``GitHub Flavored Markdown''. |
7897 | 7916 | +Markdown is like writing in plain text but which is rendered richly. |
7898 | 7917 | |
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. | |
7900 | 7919 | +See <<_example_markdown>> for an example of how comments or text can be written and then rendered using Markdown. |
7901 | 7920 | |
7921 | +-See <<r_example_markdown>> for an example of how comments or text can be written and then rendered using Markdown. | |
7922 | +- | |
7902 | 7923 | -.An example of Markdown as written and as rendered. |
7903 | 7924 | +[[_example_markdown]] |
7904 | 7925 | +.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 | ||
7906 | 7927 | |
7907 | 7928 | -===== GitHub Flavored Markdown |
7908 | 7929 | - |
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 | |
7910 | 7931 | +The GitHub flavor of Markdown adds more things you can do beyond the basic Markdown syntax. |
7911 | 7932 | +These can all be really useful when creating useful Pull Request or Issue comments or descriptions. |
7912 | 7933 | |
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. | |
7914 | 7935 | +===== Task Lists |
7915 | 7936 | |
7937 | +-====== Task Lists | |
7938 | +- | |
7916 | 7939 | -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. |
7917 | 7940 | +The first really useful GitHub specific Markdown feature, especially for use in Pull Requests, is the Task List. |
7918 | 7941 | +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 | ||
8028 | 8051 | +[source,text] |
8029 | 8052 | +---- |
8030 | 8053 | +I :eyes: that :bug: and I :cold_sweat:. |
8031 | -+ | |
8054 | + | |
8055 | +-When rendered, it would look something like <<r_md_emoji>>. | |
8032 | 8056 | +:trophy: for :microscope: it. |
8033 | -+ | |
8057 | + | |
8058 | +-.Heavy emoji commenting. | |
8034 | 8059 | +:+1: and :sparkles: on this :ship:, it's :fire::poop:! |
8035 | 8060 | + |
8036 | 8061 | +:clap::tada::panda_face: |
8037 | 8062 | +---- |
8038 | - | |
8039 | --When rendered, it would look something like <<r_md_emoji>>. | |
8063 | ++ | |
8040 | 8064 | +When rendered, it would look something like <<_md_emoji>>. |
8041 | - | |
8042 | --.Heavy emoji commenting. | |
8065 | ++ | |
8043 | 8066 | +[[_md_emoji]] |
8044 | 8067 | +.Heavy emoji commenting |
8045 | 8068 | image::images/markdown-07-emoji.png[Emoji] |
8046 | 8069 | |
8047 | 8070 | 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. |
8048 | 8071 | |
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 | |
8050 | 8076 | +[NOTE] |
8051 | 8077 | ==== |
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: | |
8053 | 8078 | +There are actually quite a number of web services that make use of emoji characters these days. |
8054 | 8079 | +A great cheat sheet to reference to find emoji that expresses what you want to say can be found at: |
8055 | 8080 | |
8056 | --http://www.emoji-cheat-sheet.com | |
8081 | +-==== | |
8057 | 8082 | +https://www.webfx.com/tools/emoji-cheat-sheet/ |
8058 | 8083 | ==== |
8059 | 8084 |
@@ -8133,7 +8158,7 @@ diff -au /tmp/book/06-github/sections/2-contributing.asc.tmp ../../git/progit2/p | ||
8133 | 8158 | +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. |
8134 | 8159 | +So you'll have to take care never to commit directly to `master`, since that branch effectively belongs to the upstream repository. |
8135 | 8160 | 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 | |
8137 | 8162 | +++ ../../git/progit2/progit2/book/06-github/sections/3-maintaining.asc 2020-07-04 16:36:46.732685561 +0900 |
8138 | 8163 | @@ -1,4 +1,4 @@ |
8139 | 8164 | -[[r_maintaining_gh_project]] |
@@ -8141,7 +8166,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8141 | 8166 | === Maintaining a Project |
8142 | 8167 | |
8143 | 8168 | 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 @@ | |
8145 | 8170 | ==== Creating a New Repository |
8146 | 8171 | |
8147 | 8172 | 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 | ||
8184 | 8209 | +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. |
8185 | 8210 | Users will have to have an account and an uploaded SSH key to access your project if you give them the SSH URL. |
8186 | 8211 | -The HTTP one is also exactly the same URL they would paste into a browser to view the project there. |
8212 | +-==== | |
8213 | +- | |
8214 | +-==== | |
8187 | 8215 | +The HTTPS one is also exactly the same URL they would paste into a browser to view the project there. |
8188 | 8216 | ==== |
8189 | 8217 | |
8190 | 8218 | ==== Adding Collaborators |
8191 | -@@ -43,16 +45,16 @@ | |
8219 | +@@ -46,16 +45,16 @@ | |
8192 | 8220 | |
8193 | 8221 | Click the ``Settings'' link at the bottom of the right-hand sidebar. |
8194 | 8222 |
@@ -8209,7 +8237,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8209 | 8237 | |
8210 | 8238 | ==== Managing Pull Requests |
8211 | 8239 | |
8212 | -@@ -63,12 +65,14 @@ | |
8240 | +@@ -66,12 +65,14 @@ | |
8213 | 8241 | |
8214 | 8242 | For these examples, let's assume you are ``tonychacon'' and you've created a new Arduino code project named ``fade''. |
8215 | 8243 |
@@ -8226,7 +8254,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8226 | 8254 | image::images/maint-01-email.png[Pull Request email notification] |
8227 | 8255 | |
8228 | 8256 | There are a few things to notice about this email. |
8229 | -@@ -77,21 +81,26 @@ | |
8257 | +@@ -80,21 +81,26 @@ | |
8230 | 8258 | It also gives you a few URLs that you can use from the command line. |
8231 | 8259 | |
8232 | 8260 | 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 | ||
8256 | 8284 | image::images/maint-03-email-resp.png[Email response] |
8257 | 8285 | |
8258 | 8286 | 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 @@ | |
8260 | 8288 | If the merge is trivial, you can also just hit the ``Merge'' button on the GitHub site. |
8261 | 8289 | This will do a ``non-fast-forward'' merge, creating a merge commit even if a fast-forward merge was possible. |
8262 | 8290 | 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 | ||
8302 | 8330 | 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. |
8303 | 8331 | |
8304 | 8332 | 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 @@ | |
8306 | 8334 | |
8307 | 8335 | Now, you could do something like fetching the reference directly. |
8308 | 8336 |
@@ -8316,7 +8344,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8316 | 8344 | This tells Git, ``Connect to the `origin` remote, and download the ref named `refs/pull/958/head`.'' |
8317 | 8345 | 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`. |
8318 | 8346 | 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 @@ | |
8320 | 8348 | Open up `.git/config` in your favorite editor, and look for the `origin` remote. |
8321 | 8349 | It should look a bit like this: |
8322 | 8350 |
@@ -8372,7 +8400,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8372 | 8400 | ===== Pull Requests on Pull Requests |
8373 | 8401 | |
8374 | 8402 | 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 @@ | |
8376 | 8404 | 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. |
8377 | 8405 | If you hit the ``Edit'' button at the right of that box you can change not only the branches but also which fork. |
8378 | 8406 |
@@ -8382,7 +8410,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8382 | 8410 | image::images/maint-04-target.png[PR targets] |
8383 | 8411 | |
8384 | 8412 | 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 @@ | |
8386 | 8414 | |
8387 | 8415 | 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. |
8388 | 8416 |
@@ -8391,7 +8419,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8391 | 8419 | image::images/maint-05-mentions.png[Mentions] |
8392 | 8420 | |
8393 | 8421 | 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 @@ | |
8395 | 8423 | You will also be subscribed to something if you opened it, if you're watching the repository or if you comment on something. |
8396 | 8424 | 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. |
8397 | 8425 |
@@ -8400,7 +8428,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8400 | 8428 | image::images/maint-06-unsubscribe.png[Unsubscribe] |
8401 | 8429 | |
8402 | 8430 | ===== The Notifications Page |
8403 | -@@ -196,7 +262,7 @@ | |
8431 | +@@ -199,7 +262,7 @@ | |
8404 | 8432 | 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. |
8405 | 8433 | If you go to the ``Notification center'' tab from the settings page, you can see some of the options you have. |
8406 | 8434 |
@@ -8409,7 +8437,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8409 | 8437 | image::images/maint-07-notifications.png[Notification center] |
8410 | 8438 | |
8411 | 8439 | 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 @@ | |
8413 | 8441 | ====== Web Notifications |
8414 | 8442 | |
8415 | 8443 | 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 | ||
8422 | 8450 | image::images/maint-08-notifications-page.png[Notification center] |
8423 | 8451 | |
8424 | 8452 | 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 @@ | |
8426 | 8454 | |
8427 | 8455 | Email notifications are the other way you can handle notifications through GitHub. |
8428 | 8456 | 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 | ||
8450 | 8478 | |
8451 | 8479 | There are a couple of interesting things here. |
8452 | 8480 | 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 | |
8463 | 8483 | |
8464 | - Since GitHub will render this file, you can embed images or links in it for added ease of understanding. | |
8465 | - | |
8466 | -+==== CONTRIBUTING | |
8467 | -+ | |
8468 | 8484 | The other special file that GitHub recognizes is the `CONTRIBUTING` file. |
8469 | 8485 | -If you have a file named `CONTRIBUTING` with any file extension, GitHub will show <<r_contrib_file>> when anyone starts opening a Pull Request. |
8470 | 8486 | +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 | ||
8475 | 8491 | image::images/maint-09-contrib.png[Contributing notice] |
8476 | 8492 | |
8477 | 8493 | 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 @@ | |
8479 | 8495 | |
8480 | 8496 | 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. |
8481 | 8497 |
@@ -8485,7 +8501,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8485 | 8501 | image::images/maint-10-default-branch.png[Default branch] |
8486 | 8502 | |
8487 | 8503 | 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 @@ | |
8489 | 8505 | |
8490 | 8506 | 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. |
8491 | 8507 |
@@ -8496,7 +8512,7 @@ diff -au /tmp/book/06-github/sections/3-maintaining.asc.tmp ../../git/progit2/pr | ||
8496 | 8512 | |
8497 | 8513 | 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. |
8498 | 8514 | 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 | |
8500 | 8516 | +++ ../../git/progit2/progit2/book/06-github/sections/4-managing-organization.asc 2020-07-04 16:36:46.732685561 +0900 |
8501 | 8517 | @@ -1,6 +1,7 @@ |
8502 | 8518 | -[[r_github_orgs]] |
@@ -8564,7 +8580,7 @@ diff -au /tmp/book/06-github/sections/4-managing-organization.asc.tmp ../../git/ | ||
8564 | 8580 | |
8565 | 8581 | You can also filter down to specific types of events, specific places or specific people. |
8566 | 8582 | 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 | |
8568 | 8584 | +++ ../../git/progit2/progit2/book/06-github/sections/5-scripting.asc 2020-07-04 16:36:46.733685573 +0900 |
8569 | 8585 | @@ -5,7 +5,7 @@ |
8570 | 8586 | 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 | ||
8622 | 8638 | ---- |
8623 | 8639 | require 'sinatra' |
8624 | 8640 | require 'json' |
8625 | -@@ -97,16 +101,19 @@ | |
8641 | +@@ -97,18 +101,19 @@ | |
8626 | 8642 | 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. |
8627 | 8643 | This makes it incredibly easy to test and debug your hooks. |
8628 | 8644 |
@@ -8638,6 +8654,8 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog | ||
8638 | 8654 | |
8639 | 8655 | ==== The GitHub API |
8640 | 8656 | |
8657 | +-==== GitHub API | |
8658 | +- | |
8641 | 8659 | -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? |
8642 | 8660 | +(((GitHub, API))) |
8643 | 8661 | +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 | ||
8645 | 8663 | |
8646 | 8664 | This is where the GitHub API comes in handy. |
8647 | 8665 | 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 @@ | |
8649 | 8667 | This could be a user or read-only information on an open source project. |
8650 | 8668 | For example, if we want to know more about a user named ``schacon'', we can run something like this: |
8651 | 8669 |
@@ -8693,7 +8711,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog | ||
8693 | 8711 | ==== Commenting on an Issue |
8694 | 8712 | |
8695 | 8713 | 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 @@ | |
8697 | 8715 | You can use basic authentication with just your username and password, but generally it's a better idea to use a personal access token. |
8698 | 8716 | You can generate this from the ``Applications'' tab of your settings page. |
8699 | 8717 |
@@ -8703,7 +8721,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog | ||
8703 | 8721 | image::images/scripting-05-access-token.png[Access Token] |
8704 | 8722 | |
8705 | 8723 | It will ask you which scopes you want for this token and a description. |
8706 | -@@ -147,9 +193,32 @@ | |
8724 | +@@ -149,9 +193,32 @@ | |
8707 | 8725 | Let's say we want to leave a comment on a specific issue, Issue #6. |
8708 | 8726 | 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. |
8709 | 8727 |
@@ -8729,16 +8747,16 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog | ||
8729 | 8747 | + "body": "A new comment, :+1:" |
8730 | 8748 | +} |
8731 | 8749 | +---- |
8750 | ++ | |
8751 | ++Now if you go to that issue, you can see the comment that we just successfully posted as in <<_api_comment>>. | |
8732 | 8752 | |
8733 | 8753 | -.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 | -+ | |
8736 | 8754 | +[[_api_comment]] |
8737 | 8755 | +.A comment posted from the GitHub API |
8738 | 8756 | image::images/scripting-06-comment.png[API Comment] |
8739 | 8757 | |
8740 | 8758 | 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 @@ | |
8742 | 8760 | |
8743 | 8761 | 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. |
8744 | 8762 |
@@ -8746,7 +8764,7 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog | ||
8746 | 8764 | ---- |
8747 | 8765 | require 'httparty' |
8748 | 8766 | require 'sinatra' |
8749 | -@@ -212,18 +282,21 @@ | |
8767 | +@@ -214,9 +282,10 @@ | |
8750 | 8768 | 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. |
8751 | 8769 | 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. |
8752 | 8770 |
@@ -8759,11 +8777,8 @@ diff -au /tmp/book/06-github/sections/5-scripting.asc.tmp ../../git/progit2/prog | ||
8759 | 8777 | image::images/scripting-07-status.png[Commit status] |
8760 | 8778 | |
8761 | 8779 | 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 @@ | |
8764 | 8781 | |
8765 | -+==== Octokit | |
8766 | -+ | |
8767 | 8782 | 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. |
8768 | 8783 | At the time of this writing, the supported languages include Go, Objective-C, Ruby, and .NET. |
8769 | 8784 | -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 | ||
8772 | 8787 | Hopefully these tools can help you customize and modify GitHub to work better for your specific workflows. |
8773 | 8788 | For complete documentation on the entire API as well as guides for common tasks, check out https://developer.github.com[]. |
8774 | 8789 | 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 | |
8776 | 8791 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/advanced-merging.asc 2020-07-04 16:36:46.733685573 +0900 |
8777 | 8792 | @@ -1,4 +1,4 @@ |
8778 | 8793 | -[[r_advanced_merging]] |
@@ -9059,7 +9074,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9059 | 9074 | ===== Checking Out Conflicts |
9060 | 9075 | |
9061 | 9076 | 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 @@ | |
9063 | 9078 | Let's change up the example a little. |
9064 | 9079 | 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. |
9065 | 9080 |
@@ -9097,7 +9112,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9097 | 9112 | +def hello |
9098 | 9113 | +<<<<<<< HEAD |
9099 | 9114 | + puts 'hola world' |
9100 | -+======= | |
9115 | + ======= | |
9101 | 9116 | + puts 'hello mundo' |
9102 | 9117 | +>>>>>>> mundo |
9103 | 9118 | +end |
@@ -9135,7 +9150,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9135 | 9150 | + puts 'hola world' |
9136 | 9151 | +||||||| base |
9137 | 9152 | + puts 'hello world' |
9138 | -+======= | |
9153 | + ======= | |
9139 | 9154 | + puts 'hello mundo' |
9140 | 9155 | +>>>>>>> theirs |
9141 | 9156 | +end |
@@ -9191,7 +9206,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9191 | 9206 | If you run that with the `-p` option instead, you get just the diffs to the file that ended up in conflict. |
9192 | 9207 | 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. |
9193 | 9208 | |
9194 | -@@ -157,20 +441,91 @@ | |
9209 | +@@ -159,20 +441,91 @@ | |
9195 | 9210 | |
9196 | 9211 | When you run `git diff` directly after a merge conflict, it will give you information in a rather unique diff output format. |
9197 | 9212 |
@@ -9284,7 +9299,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9284 | 9299 | ==== Undoing Merges |
9285 | 9300 | |
9286 | 9301 | 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 @@ | |
9288 | 9303 | Let's say you started work on a topic branch, accidentally merged it into `master`, and now your commit history looks like this: |
9289 | 9304 | |
9290 | 9305 | .Accidental merge commit |
@@ -9293,7 +9308,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9293 | 9308 | |
9294 | 9309 | There are two ways to approach this problem, depending on what your desired outcome is. |
9295 | 9310 | |
9296 | -@@ -190,9 +545,9 @@ | |
9311 | +@@ -192,9 +545,9 @@ | |
9297 | 9312 | 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: |
9298 | 9313 | |
9299 | 9314 | .History after `git reset --hard HEAD~` |
@@ -9305,7 +9320,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9305 | 9320 | Here's a quick refresher: `reset --hard` usually goes through three steps: |
9306 | 9321 | |
9307 | 9322 | . Move the branch HEAD points to. |
9308 | -@@ -201,14 +556,21 @@ | |
9323 | +@@ -203,14 +556,21 @@ | |
9309 | 9324 | . Make the working directory look like the index. |
9310 | 9325 | |
9311 | 9326 | 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 | ||
9328 | 9343 | The `-m 1` flag indicates which parent is the ``mainline'' and should be kept. |
9329 | 9344 | 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`). |
9330 | 9345 | 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 @@ | |
9332 | 9347 | The history with the revert commit looks like this: |
9333 | 9348 | |
9334 | 9349 | .History after `git revert -m 1` |
@@ -9366,7 +9381,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9366 | 9381 | |
9367 | 9382 | In this example, `M` and `^M` cancel out. |
9368 | 9383 | `^^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 @@ | |
9370 | 9385 | |
9371 | 9386 | If we go back to the ``hello world'' example we were using before, we can see that merging in our branch causes conflicts. |
9372 | 9387 |
@@ -9395,7 +9410,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9395 | 9410 | 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''. |
9396 | 9411 | However, all the other non-conflicting changes on that branch are merged successfully in. |
9397 | 9412 | |
9398 | -@@ -269,9 +664,19 @@ | |
9413 | +@@ -271,9 +664,19 @@ | |
9399 | 9414 | 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. |
9400 | 9415 | It will simply record as the result of the merge the exact code in your current branch. |
9401 | 9416 |
@@ -9416,7 +9431,7 @@ diff -au /tmp/book/07-git-tools/sections/advanced-merging.asc.tmp ../../git/prog | ||
9416 | 9431 | + |
9417 | 9432 | +include::subtree-merges.asc[] |
9418 | 9433 | 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 | |
9420 | 9435 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/bundling.asc 2020-06-28 16:44:50.939017414 +0900 |
9421 | 9436 | @@ -1,4 +1,4 @@ |
9422 | 9437 | -[[r_bundling]] |
@@ -9585,7 +9600,7 @@ diff -au /tmp/book/07-git-tools/sections/bundling.asc.tmp ../../git/progit2/prog | ||
9585 | 9600 | |
9586 | 9601 | 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. |
9587 | 9602 | 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 | |
9589 | 9604 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/credentials.asc 2020-06-28 16:44:50.939017414 +0900 |
9590 | 9605 | @@ -1,6 +1,8 @@ |
9591 | 9606 | -[[r_credential_caching]] |
@@ -9741,7 +9756,7 @@ diff -au /tmp/book/07-git-tools/sections/credentials.asc.tmp ../../git/progit2/p | ||
9741 | 9756 | + |
9742 | 9757 | As you can see, extending this system is pretty straightforward, and can solve some common problems for you and your team. |
9743 | 9758 | 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 | |
9745 | 9760 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/debugging.asc 2020-06-28 16:44:50.939017414 +0900 |
9746 | 9761 | @@ -1,62 +1,149 @@ |
9747 | 9762 | === Debugging with Git |
@@ -9913,7 +9928,7 @@ diff -au /tmp/book/07-git-tools/sections/debugging.asc.tmp ../../git/progit2/pro | ||
9913 | 9928 | Doing so automatically runs `test-error.sh` on each checked-out commit until Git finds the first broken commit. |
9914 | 9929 | You can also run something like `make` or `make tests` or whatever you have that runs automated tests for you. |
9915 | 9930 | 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 | |
9917 | 9932 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/interactive-staging.asc 2020-06-28 16:44:50.939017414 +0900 |
9918 | 9933 | @@ -1,57 +1,204 @@ |
9919 | 9934 | -[[r_interactive_staging]] |
@@ -10146,7 +10161,7 @@ diff -au /tmp/book/07-git-tools/sections/interactive-staging.asc.tmp ../../git/p | ||
10146 | 10161 | +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. |
10147 | 10162 | We'll go into more details on each of these as we get to more advanced usages of these commands. |
10148 | 10163 | 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 | |
10150 | 10165 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/replace.asc 2020-07-04 16:36:46.733685573 +0900 |
10151 | 10166 | @@ -1,13 +1,13 @@ |
10152 | 10167 | -[[r_replace]] |
@@ -10236,7 +10251,7 @@ diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progi | ||
10236 | 10251 | 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. |
10237 | 10252 | 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. |
10238 | 10253 | |
10239 | -@@ -34,37 +83,124 @@ | |
10254 | +@@ -34,40 +83,124 @@ | |
10240 | 10255 | So, our base commit will be based off of that tree. |
10241 | 10256 | 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. |
10242 | 10257 |
@@ -10255,8 +10270,10 @@ diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progi | ||
10255 | 10270 | +You can read more about plumbing commands in <<ch10-git-internals#_plumbing_porcelain>>. |
10256 | 10271 | ===== |
10257 | 10272 | |
10273 | +-===== | |
10274 | +-===== | |
10258 | 10275 | +image::images/replace3.png[] |
10259 | -+ | |
10276 | + | |
10260 | 10277 | 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`. |
10261 | 10278 | 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`): |
10262 | 10279 |
@@ -10364,9 +10381,9 @@ diff -au /tmp/book/07-git-tools/sections/replace.asc.tmp ../../git/progit2/progi | ||
10364 | 10381 | 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. |
10365 | 10382 | 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. |
10366 | 10383 | 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 | |
10368 | 10385 | +++ ../../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 @@ | |
10370 | 10387 | -[[r_rerere]] |
10371 | 10388 | +[[ref_rerere]] |
10372 | 10389 | === Rerere |
@@ -10574,8 +10591,6 @@ diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit | ||
10574 | 10591 | -You can also recreate the conflicted file state with the `checkout` command: |
10575 | 10592 | +Also, `git diff` will show you how it was automatically re-resolved: |
10576 | 10593 | |
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: | |
10579 | 10594 | +[source,console] |
10580 | 10595 | +---- |
10581 | 10596 | +$ git diff |
@@ -10606,7 +10621,9 @@ diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit | ||
10606 | 10621 | +def hello |
10607 | 10622 | +<<<<<<< ours |
10608 | 10623 | + 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: | |
10610 | 10627 | + puts 'hello mundo' |
10611 | 10628 | +>>>>>>> theirs |
10612 | 10629 | +end |
@@ -10640,7 +10657,7 @@ diff -au /tmp/book/07-git-tools/sections/rerere.asc.tmp ../../git/progit2/progit | ||
10640 | 10657 | + |
10641 | 10658 | +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. |
10642 | 10659 | 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 | |
10644 | 10661 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/reset.asc 2020-07-04 16:36:46.733685573 +0900 |
10645 | 10662 | @@ -1,16 +1,16 @@ |
10646 | 10663 | -[[r_git_reset]] |
@@ -10664,8 +10681,12 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2 | ||
10664 | 10681 | |
10665 | 10682 | Git as a system manages and manipulates three trees in its normal operation: |
10666 | 10683 | |
10667 | -@@ -26,63 +26,112 @@ | |
10684 | +@@ -24,67 +24,114 @@ | |
10685 | + | |
10686 | + ===== The HEAD | |
10668 | 10687 | |
10688 | +-===== HEAD | |
10689 | +- | |
10669 | 10690 | HEAD is the pointer to the current branch reference, which is in turn a pointer to the last commit made on that branch. |
10670 | 10691 | That means HEAD will be the parent of the next commit that is created. |
10671 | 10692 | -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 | ||
10689 | 10710 | +100644 blob 8f94139338f9404f2... Rakefile |
10690 | 10711 | +040000 tree 99f1a6d12cb4b6f19... lib |
10691 | 10712 | +---- |
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. | |
10694 | 10713 | + |
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 | + | |
10695 | 10716 | +[[_the_index]] |
10696 | 10717 | ===== The Index |
10697 | 10718 |
@@ -10749,16 +10770,16 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2 | ||
10749 | 10770 | We'll call this *v1* of the file, and we'll indicate it in blue. |
10750 | 10771 | -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). |
10751 | 10772 | +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[] | |
10754 | 10773 | |
10755 | 10774 | -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[] | |
10757 | 10776 | |
10758 | 10777 | -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. | |
10760 | 10779 | |
10761 | 10780 | -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 | ++ | |
10762 | 10783 | +image::images/reset-ex2.png[] |
10763 | 10784 | + |
10764 | 10785 | +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 | ||
10775 | 10796 | -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. |
10776 | 10797 | -Next we run `git add` on it to stage it into our Index. |
10777 | 10798 | +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. | |
10781 | 10799 | |
10782 | 10800 | -At this point if we run `git status` we will see the file in green |
10783 | 10801 | -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 | ++ | |
10784 | 10805 | +image::images/reset-ex5.png[] |
10785 | 10806 | + |
10786 | 10807 | +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 | ||
10796 | 10817 | |
10797 | 10818 | ==== The Role of Reset |
10798 | 10819 | |
10799 | -@@ -91,6 +140,8 @@ | |
10820 | +@@ -93,6 +140,8 @@ | |
10800 | 10821 | For the purposes of these examples, let's say that we've modified `file.txt` again and committed it a third time. |
10801 | 10822 | So now our history looks like this: |
10802 | 10823 |
@@ -10805,7 +10826,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2 | ||
10805 | 10826 | Let's now walk through exactly what `reset` does when you call it. |
10806 | 10827 | It directly manipulates these three trees in a simple and predictable way. |
10807 | 10828 | It does up to three basic operations. |
10808 | -@@ -101,19 +152,23 @@ | |
10829 | +@@ -103,19 +152,23 @@ | |
10809 | 10830 | This isn't the same as changing HEAD itself (which is what `checkout` does); `reset` moves the branch that HEAD is pointing to. |
10810 | 10831 | 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`. |
10811 | 10832 |
@@ -10833,7 +10854,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2 | ||
10833 | 10854 | |
10834 | 10855 | If you specify the `--mixed` option, `reset` will stop at this point. |
10835 | 10856 | 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 @@ | |
10837 | 10858 | |
10838 | 10859 | ===== Step 3: Updating the Working Directory (--hard) |
10839 | 10860 |
@@ -10933,7 +10954,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2 | ||
10933 | 10954 | 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`. |
10934 | 10955 | The commit with the v2 version of the file is no longer in the history. |
10935 | 10956 | |
10936 | -@@ -199,11 +267,11 @@ | |
10957 | +@@ -201,11 +267,11 @@ | |
10937 | 10958 | 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. |
10938 | 10959 | |
10939 | 10960 | 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 | ||
10948 | 10969 | |
10949 | 10970 | 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). |
10950 | 10971 | 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 @@ | |
10952 | 10973 | So, in both cases we're moving HEAD to point to commit A, but _how_ we do so is very different. |
10953 | 10974 | `reset` will move the branch HEAD points to, `checkout` moves HEAD itself. |
10954 | 10975 |
@@ -10963,7 +10984,7 @@ diff -au /tmp/book/07-git-tools/sections/reset.asc.tmp ../../git/progit2/progit2 | ||
10963 | 10984 | |
10964 | 10985 | 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. |
10965 | 10986 | |
10966 | -@@ -227,7 +297,7 @@ | |
10987 | +@@ -229,7 +297,7 @@ | |
10967 | 10988 | |
10968 | 10989 | Here's a cheat-sheet for which commands affect which trees. |
10969 | 10990 | 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 | ||
10972 | 10993 | |
10973 | 10994 | [options="header", cols="3,1,1,1,1"] |
10974 | 10995 | |================================ |
10975 | -@@ -236,8 +306,8 @@ | |
10996 | +@@ -238,8 +306,8 @@ | |
10976 | 10997 | | `reset --soft [commit]` | REF | NO | NO | YES |
10977 | 10998 | | `reset [commit]` | REF | YES | NO | YES |
10978 | 10999 | | `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 | ||
10985 | 11006 | +| `checkout [commit] <paths>` | NO | YES | YES | *NO* |
10986 | 11007 | |================================ |
10987 | 11008 | 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 | |
10989 | 11010 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/revision-selection.asc 2020-10-24 08:43:10.529548324 +0900 |
10990 | 11011 | @@ -1,36 +1,76 @@ |
10991 | 11012 | -[[r_revision_selection]] |
@@ -11077,7 +11098,7 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr | ||
11077 | 11098 | |
11078 | 11099 | However, you should be aware of how ridiculously unlikely this scenario is. |
11079 | 11100 | The SHA-1 digest is 20 bytes or 160 bits. |
11080 | -@@ -38,117 +78,326 @@ | |
11101 | +@@ -38,120 +78,326 @@ | |
11081 | 11102 | (the formula for determining collision probability is `p = (n(n-1)/2) * (1/2^160))`. 2^80^ |
11082 | 11103 | is 1.2 x 10^24^ |
11083 | 11104 | or 1 million billion billion. |
@@ -11087,10 +11108,12 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr | ||
11087 | 11108 | -Here’s an example to give you an idea of what it would take to get a SHA-1 collision. |
11088 | 11109 | -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. |
11089 | 11110 | -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 | +-==== | |
11090 | 11112 | +Here's an example to give you an idea of what it would take to get a SHA-1 collision. |
11091 | 11113 | +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. |
11092 | 11114 | +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 | +-==== | |
11094 | 11117 | +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. |
11095 | 11118 | +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). |
11096 | 11119 | ==== |
@@ -11157,14 +11180,14 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr | ||
11157 | 11180 | You can also use this syntax to see where a branch was some specific amount of time ago. |
11158 | 11181 | -For instance, to see where your `master` branch was yesterday, you can type |
11159 | 11182 | +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. | |
11161 | 11186 | +[source,console] |
11162 | 11187 | +---- |
11163 | 11188 | +$ git show master@{yesterday} |
11164 | 11189 | +---- |
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 | ++ | |
11168 | 11191 | +That would show you where tip of your `master` branch was yesterday. |
11169 | 11192 | +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. |
11170 | 11193 |
@@ -11251,7 +11274,8 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr | ||
11251 | 11274 | +Merge: 1c002dd... 35cfb2b... |
11252 | 11275 | +Author: Scott Chacon <schacon@gmail.com> |
11253 | 11276 | +Date: Thu Dec 11 15:08:43 2008 -0800 |
11254 | -+ | |
11277 | + | |
11278 | +-The other main ancestry specification is the `~`. | |
11255 | 11279 | + Merge commit 'phedders/rdocs' |
11256 | 11280 | +---- |
11257 | 11281 | + |
@@ -11290,8 +11314,7 @@ diff -au /tmp/book/07-git-tools/sections/revision-selection.asc.tmp ../../git/pr | ||
11290 | 11314 | + |
11291 | 11315 | + Some rdoc changes |
11292 | 11316 | +---- |
11293 | - | |
11294 | --The other main ancestry specification is the `~`. | |
11317 | ++ | |
11295 | 11318 | +The other main ancestry specification is the `~` (tilde). |
11296 | 11319 | This also refers to the first parent, so `HEAD~` and `HEAD^` are equivalent. |
11297 | 11320 | 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 | ||
11456 | 11479 | |
11457 | 11480 | With these tools, you can much more easily let Git know what commit or commits you want to inspect. |
11458 | 11481 | 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 | |
11460 | 11483 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/rewriting-history.asc 2020-09-12 09:27:13.222663694 +0900 |
11461 | 11484 | @@ -1,114 +1,346 @@ |
11462 | 11485 | -[[r_rewriting_history]] |
@@ -11895,9 +11918,9 @@ diff -au /tmp/book/07-git-tools/sections/rewriting-history.asc.tmp ../../git/pro | ||
11895 | 11918 | This goes through and rewrites every commit to have your new address. |
11896 | 11919 | 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. |
11897 | 11920 | 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 | |
11899 | 11922 | +++ ../../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 @@ | |
11901 | 11924 | -[[r_searching]] |
11902 | 11925 | +[[_searching]] |
11903 | 11926 | === Searching |
@@ -11907,20 +11930,21 @@ diff -au /tmp/book/07-git-tools/sections/searching.asc.tmp ../../git/progit2/pro | ||
11907 | 11930 | Git provides a couple of useful tools for looking through the code and commits stored in its database quickly and easily. |
11908 | 11931 | We'll go through a few of them. |
11909 | 11932 | |
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. | |
11912 | 11933 | +[[_git_grep]] |
11913 | -+==== Git Grep | |
11934 | + ==== Git Grep | |
11914 | 11935 | |
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. | |
11917 | 11938 | +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. |
11918 | 11939 | +For the examples that follow, we'll search through the source code for Git itself. |
11919 | 11940 | |
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. | |
11921 | 11943 | +By default, `git grep` will look through the files in your working directory. |
11922 | 11944 | +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: |
11923 | 11945 | |
11946 | +-There are a number of interesting options you can provide the `grep` command. | |
11947 | +- | |
11924 | 11948 | -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: |
11925 | 11949 | - |
11926 | 11950 | -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 | ||
12006 | 12030 | |
12007 | 12031 | The `git grep` command has a few advantages over normal searching commands like `grep` and `ack`. |
12008 | 12032 | 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 @@ | |
12010 | 12034 | |
12011 | 12035 | ==== Git Log Searching |
12012 | 12036 |
@@ -12083,7 +12107,7 @@ diff -au /tmp/book/07-git-tools/sections/searching.asc.tmp ../../git/progit2/pro | ||
12083 | 12107 | +For example, this would have done the same thing as the example above: `git log -L '/unsigned long git_deflate_bound/',/^}/:zlib.c`. |
12084 | 12108 | You could also give it a range of lines or a single line number and you'll get the same sort of output. |
12085 | 12109 | 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 | |
12087 | 12111 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/signing.asc 2020-06-28 16:44:50.941017708 +0900 |
12088 | 12112 | @@ -1,4 +1,4 @@ |
12089 | 12113 | -[[r_signing]] |
@@ -12122,7 +12146,7 @@ diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progi | ||
12122 | 12146 | Now Git will use your key by default to sign tags and commits if you want. |
12123 | 12147 | |
12124 | 12148 | ==== Signing Tags |
12125 | -@@ -19,36 +39,163 @@ | |
12149 | +@@ -19,37 +39,163 @@ | |
12126 | 12150 | If you have a GPG private key setup, you can now use it to sign new tags. |
12127 | 12151 | All you have to do is use `-s` instead of `-a`: |
12128 | 12152 |
@@ -12154,7 +12178,7 @@ diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progi | ||
12154 | 12178 | +ecorc4iXzQu7tupRihslbNkfvfciMnSDeSvzCpWAHl7h8Wj6hhqePmLm9lAYqnKp |
12155 | 12179 | +8S5B/1SSQuEAjRZgI4IexpZoeKGVDptPHxLLS38fozsyi0QyDyzEgJxcJQVMXxVi |
12156 | 12180 | +RUysgqjcpT8+iQM1PblGfHR4XAhuOqN5Fx06PSaFZhqvWFezJ28/CLyX5q+oIVk= |
12157 | -+=EFTF | |
12181 | + =EFTF | |
12158 | 12182 | +-----END PGP SIGNATURE----- |
12159 | 12183 | + |
12160 | 12184 | +commit ca82a6dff817ec66f44342007202690a93763949 |
@@ -12292,7 +12316,7 @@ diff -au /tmp/book/07-git-tools/sections/signing.asc.tmp ../../git/progit2/progi | ||
12292 | 12316 | |
12293 | 12317 | 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. |
12294 | 12318 | 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 | |
12296 | 12320 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/stashing-cleaning.asc 2020-06-28 16:44:50.941017708 +0900 |
12297 | 12321 | @@ -1,72 +1,234 @@ |
12298 | 12322 | -[[r_git_stashing]] |
@@ -12621,7 +12645,7 @@ diff -au /tmp/book/07-git-tools/sections/stashing-cleaning.asc.tmp ../../git/pro | ||
12621 | 12645 | +In cases like that, you need to add a second `-f` option for emphasis. |
12622 | 12646 | +==== |
12623 | 12647 | 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 | |
12625 | 12649 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/submodules.asc 2020-07-21 09:34:56.067548780 +0900 |
12626 | 12650 | @@ -1,21 +1,22 @@ |
12627 | 12651 | -[[r_git_submodules]] |
@@ -12653,7 +12677,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
12653 | 12677 | ==== Starting with Submodules |
12654 | 12678 | |
12655 | 12679 | 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 @@ | |
12657 | 12681 | 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. |
12658 | 12682 | In this example, we'll add a library called ``DbConnector''. |
12659 | 12683 |
@@ -12706,12 +12730,13 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
12706 | 12730 | This is how other people who clone this project know where to get the submodule projects from. |
12707 | 12731 | |
12708 | 12732 | +[NOTE] |
12709 | -+===== | |
12733 | + ===== | |
12710 | 12734 | 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. |
12711 | 12735 | 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. |
12712 | 12736 | You can overwrite this value locally with `git config submodule.DbConnector.url PRIVATE_URL` for your own use. |
12713 | 12737 | When applicable, a relative URL can be helpful. |
12714 | -+===== | |
12738 | +- | |
12739 | + ===== | |
12715 | 12740 | |
12716 | 12741 | The other listing in the `git status` output is the project folder entry. |
12717 | 12742 | 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 | ||
12765 | 12790 | +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. |
12766 | 12791 | + |
12767 | 12792 | +Lastly, push these changes: |
12768 | - | |
12793 | ++ | |
12769 | 12794 | +[source,console] |
12770 | 12795 | +---- |
12771 | 12796 | +$ git push origin master |
12772 | 12797 | +---- |
12773 | -+ | |
12798 | + | |
12774 | 12799 | +[[_cloning_submodules]] |
12775 | 12800 | ==== Cloning a Project with Submodules |
12776 | 12801 |
@@ -13096,7 +13121,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
13096 | 13121 | |
13097 | 13122 | ===== Working on a Submodule |
13098 | 13123 | |
13099 | -@@ -113,53 +460,181 @@ | |
13124 | +@@ -116,53 +460,181 @@ | |
13100 | 13125 | 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. |
13101 | 13126 | |
13102 | 13127 | 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 | ||
13283 | 13308 | |
13284 | 13309 | ===== Merging Submodule Changes |
13285 | 13310 | |
13286 | -@@ -171,6 +646,22 @@ | |
13311 | +@@ -174,6 +646,22 @@ | |
13287 | 13312 | Git will not attempt even a trivial merge for you, however. |
13288 | 13313 | If the submodule commits diverge and need to be merged, you will get something that looks like this: |
13289 | 13314 |
@@ -13306,7 +13331,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
13306 | 13331 | 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. |
13307 | 13332 | It explains it as ``merge following commits not found'', which is confusing but we'll explain why that is in a bit. |
13308 | 13333 | |
13309 | -@@ -179,6 +670,15 @@ | |
13334 | +@@ -182,6 +670,15 @@ | |
13310 | 13335 | Fortunately, it's simple to figure out. |
13311 | 13336 | If you run `git diff` you can get the SHA-1s of the commits recorded in both branches you were trying to merge. |
13312 | 13337 |
@@ -13322,7 +13347,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
13322 | 13347 | So, in this case, `eb41d76` is the commit in our submodule that *we* had and `c771610` is the commit that upstream had. |
13323 | 13348 | If we go into our submodule directory, it should already be on `eb41d76` as the merge would not have touched it. |
13324 | 13349 | 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 @@ | |
13326 | 13351 | 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. |
13327 | 13352 | We would suggest the latter, even if only to make a nicer merge commit message. |
13328 | 13353 |
@@ -13384,7 +13409,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
13384 | 13409 | |
13385 | 13410 | It can be a bit confusing, but it's really not very hard. |
13386 | 13411 | |
13387 | -@@ -209,7 +749,38 @@ | |
13412 | +@@ -212,7 +749,38 @@ | |
13388 | 13413 | |
13389 | 13414 | If it does find a single acceptable merge commit, you'll see something like this: |
13390 | 13415 |
@@ -13424,15 +13449,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
13424 | 13449 | |
13425 | 13450 | 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. |
13426 | 13451 | |
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 @@ | |
13436 | 13453 | 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. |
13437 | 13454 | We can easily stash all the work in all our submodules. |
13438 | 13455 |
@@ -13678,7 +13695,7 @@ diff -au /tmp/book/07-git-tools/sections/submodules.asc.tmp ../../git/progit2/pr | ||
13678 | 13695 | You may need to go into your submodule directory and run a `git checkout .` to get all your files back. |
13679 | 13696 | You could run this in a `submodule foreach` script to run it for multiple submodules. |
13680 | 13697 | 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 | |
13682 | 13699 | +++ ../../git/progit2/progit2/book/07-git-tools/sections/subtree-merges.asc 2020-07-04 16:36:46.737685622 +0900 |
13683 | 13700 | @@ -1,4 +1,4 @@ |
13684 | 13701 | -[[r_subtree_merge]] |
@@ -13789,7 +13806,7 @@ diff -au /tmp/book/07-git-tools/sections/subtree-merges.asc.tmp ../../git/progit | ||
13789 | 13806 | +$ git diff-tree -p rack_remote/master |
13790 | 13807 | +---- |
13791 | 13808 | 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 | |
13793 | 13810 | +++ ../../git/progit2/progit2/book/08-customizing-git/sections/attributes.asc 2020-07-04 16:36:46.738685634 +0900 |
13794 | 13811 | @@ -1,5 +1,6 @@ |
13795 | 13812 | === Git Attributes |
@@ -14015,7 +14032,7 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog | ||
14015 | 14032 | 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. |
14016 | 14033 | The `cat` program does essentially nothing: it spits out the same data that it comes in. |
14017 | 14034 | This combination effectively filters all C source code files through `indent` before committing. |
14018 | -@@ -115,45 +228,125 @@ | |
14035 | +@@ -115,22 +228,57 @@ | |
14019 | 14036 | 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. |
14020 | 14037 | Here is a small Ruby script that does that: |
14021 | 14038 |
@@ -14072,11 +14089,8 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog | ||
14072 | 14089 | +(((archiving))) |
14073 | 14090 | Git attribute data also allows you to do some interesting things when exporting an archive of your project. |
14074 | 14091 | |
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 @@ | |
14080 | 14094 | 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. |
14081 | 14095 | You can add the following line to your Git attributes file: |
14082 | 14096 |
@@ -14085,13 +14099,13 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog | ||
14085 | 14099 | +---- |
14086 | 14100 | +test/ export-ignore |
14087 | 14101 | +---- |
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` | |
14088 | 14106 | |
14089 | 14107 | -When exporting files for deployment you can apply `git log`'s formatting and keyword-expansion processing to selected portions of files marked with the |
14090 | 14108 | -`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 | -+ | |
14095 | 14109 | +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. |
14096 | 14110 | |
14097 | 14111 | 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 | ||
14145 | 14159 | You can also use Git attributes to tell Git to use different merge strategies for specific files in your project. |
14146 | 14160 | 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. |
14147 | 14161 | |
14148 | -@@ -161,8 +354,25 @@ | |
14162 | +@@ -165,8 +354,25 @@ | |
14149 | 14163 | 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. |
14150 | 14164 | You can set up an attribute like this: |
14151 | 14165 |
@@ -14172,9 +14186,9 @@ diff -au /tmp/book/08-customizing-git/sections/attributes.asc.tmp ../../git/prog | ||
14172 | 14186 | + |
14173 | 14187 | In this case, `database.xml` stays at whatever version you originally had. |
14174 | 14188 | 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 | |
14176 | 14190 | +++ ../../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 @@ | |
14178 | 14192 | -[[r_git_config]] |
14179 | 14193 | +[[_git_config]] |
14180 | 14194 | === Git Configuration |
@@ -14209,10 +14223,11 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14209 | 14223 | +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. |
14210 | 14224 | |
14211 | 14225 | +[NOTE] |
14212 | -+==== | |
14226 | + ==== | |
14213 | 14227 | Git's configuration files are plain-text, so you can also set these values by manually editing the file and inserting the correct syntax. |
14214 | 14228 | It's generally easier to run the `git config` command, though. |
14215 | -+==== | |
14229 | +- | |
14230 | + ==== | |
14216 | 14231 | |
14217 | 14232 | ==== Basic Client Configuration |
14218 | 14233 |
@@ -14233,8 +14248,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14233 | 14248 | This command lists all the available options in quite a bit of detail. |
14234 | 14249 | -You can also find this reference material at http://git-scm.com/docs/git-config.html[]. |
14235 | 14250 | +You can also find this reference material at https://git-scm.com/docs/git-config[]. |
14236 | -+ | |
14237 | -+===== `core.editor` | |
14251 | + | |
14252 | + ===== `core.editor` | |
14238 | 14253 | |
14239 | 14254 | -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. |
14240 | 14255 | +((($EDITOR)))((($VISUAL, see $EDITOR))) |
@@ -14248,10 +14263,10 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14248 | 14263 | + |
14249 | 14264 | Now, no matter what is set as your default shell editor, Git will fire up Emacs to edit messages. |
14250 | 14265 | |
14266 | + ===== `commit.template` | |
14267 | + | |
14251 | 14268 | -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. |
14252 | 14269 | -For instance, suppose you create a template file at `~/.gitmessage.txt` that looks like this: |
14253 | -+===== `commit.template` | |
14254 | -+ | |
14255 | 14270 | +(((commit templates))) |
14256 | 14271 | +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. |
14257 | 14272 | +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/ | ||
14303 | 14318 | + |
14304 | 14319 | 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. |
14305 | 14320 | |
14306 | -+===== `core.pager` | |
14307 | -+ | |
14321 | + ===== `core.pager` | |
14322 | + | |
14308 | 14323 | +(((pager))) |
14309 | 14324 | This setting determines which pager is used when Git pages output such as `log` and `diff`. |
14310 | 14325 | 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/ | ||
14316 | 14331 | + |
14317 | 14332 | If you run that, Git will page the entire output of all commands, no matter how long they are. |
14318 | 14333 | |
14334 | + ===== `user.signingkey` | |
14335 | + | |
14319 | 14336 | -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 | -+ | |
14322 | 14337 | +(((GPG))) |
14323 | 14338 | +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. |
14324 | 14339 | Set your key ID like so: |
@@ -14330,14 +14345,14 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14330 | 14345 | + |
14331 | 14346 | Now, you can sign tags without having to specify your key every time with the `git tag` command: |
14332 | 14347 | |
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>>. | |
14334 | 14348 | +[source,console] |
14335 | 14349 | +---- |
14336 | 14350 | +$ git tag -s <tag-name> |
14337 | 14351 | +---- |
14338 | 14352 | + |
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>>. | |
14341 | 14356 | +(((excludes)))(((.gitignore))) |
14342 | 14357 | +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>>. |
14343 | 14358 |
@@ -14359,8 +14374,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14359 | 14374 | + |
14360 | 14375 | …and you run `git config --global core.excludesfile ~/.gitignore_global`, Git will never again bother you about those files. |
14361 | 14376 | |
14362 | -+===== `help.autocorrect` | |
14363 | -+ | |
14377 | + ===== `help.autocorrect` | |
14378 | + | |
14364 | 14379 | +(((autocorrect))) |
14365 | 14380 | If you mistype a command, it shows you something like this: |
14366 | 14381 |
@@ -14395,8 +14410,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14395 | 14410 | Git fully supports colored terminal output, which greatly aids in visually parsing command output quickly and easily. |
14396 | 14411 | A number of options can help you set the coloring to your preference. |
14397 | 14412 | |
14398 | -+===== `color.ui` | |
14399 | -+ | |
14413 | +@@ -100,6 +205,11 @@ | |
14400 | 14414 | Git automatically colors most of its output, but there's a master switch if you don't like this behavior. |
14401 | 14415 | To turn off all Git's colored terminal output, do this: |
14402 | 14416 |
@@ -14408,11 +14422,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14408 | 14422 | 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. |
14409 | 14423 | |
14410 | 14424 | 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 @@ | |
14416 | 14426 | If you want to be more specific about which commands are colored and how, Git provides verb-specific coloring settings. |
14417 | 14427 | Each of these can be set to `true`, `false`, or `always`: |
14418 | 14428 |
@@ -14585,8 +14595,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14585 | 14595 | 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. |
14586 | 14596 | Git has a few configuration options to help with these issues. |
14587 | 14597 | |
14588 | -+===== `core.autocrlf` | |
14589 | -+ | |
14598 | + ===== `core.autocrlf` | |
14599 | + | |
14590 | 14600 | +(((crlf)))(((line endings))) |
14591 | 14601 | 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. |
14592 | 14602 | -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/ | ||
14622 | 14632 | +$ git config --global core.autocrlf false |
14623 | 14633 | +---- |
14624 | 14634 | + |
14625 | -+===== `core.whitespace` | |
14626 | -+ | |
14635 | + ===== `core.whitespace` | |
14636 | + | |
14627 | 14637 | Git comes preset to detect and fix some whitespace issues. |
14628 | 14638 | -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. |
14629 | 14639 | +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/ | ||
14671 | 14681 | These options apply to the `git rebase` command as well. |
14672 | 14682 | 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. |
14673 | 14683 | |
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 @@ | |
14681 | 14685 | 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. |
14682 | 14686 | If you want Git to check object consistency on every push, you can force it to do so by setting `receive.fsckObjects` to true: |
14683 | 14687 |
@@ -14688,10 +14692,8 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14688 | 14692 | + |
14689 | 14693 | 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. |
14690 | 14694 | |
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 @@ | |
14695 | 14697 | |
14696 | 14698 | To tell Git to refuse force-pushes, set `receive.denyNonFastForwards`: |
14697 | 14699 |
@@ -14703,8 +14705,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14703 | 14705 | The other way you can do this is via server-side receive hooks, which we'll cover in a bit. |
14704 | 14706 | That approach lets you do more complex things like deny non-fast-forwards to a certain subset of users. |
14705 | 14707 | |
14706 | -+===== `receive.denyDeletes` | |
14707 | -+ | |
14708 | +@@ -235,6 +501,11 @@ | |
14708 | 14709 | 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. |
14709 | 14710 | To avoid this, set `receive.denyDeletes` to true: |
14710 | 14711 |
@@ -14719,7 +14720,7 @@ diff -au /tmp/book/08-customizing-git/sections/config.asc.tmp ../../git/progit2/ | ||
14719 | 14720 | -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>>. |
14720 | 14721 | +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>>. |
14721 | 14722 | 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 | |
14723 | 14724 | +++ ../../git/progit2/progit2/book/08-customizing-git/sections/hooks.asc 2020-09-26 08:56:07.952296414 +0900 |
14724 | 14725 | @@ -1,6 +1,7 @@ |
14725 | 14726 | -[[r_git_hooks]] |
@@ -14739,20 +14740,20 @@ diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/p | ||
14739 | 14740 | If you want to use the bundled hook scripts, you'll have to rename them; their file names all end with `.sample`. |
14740 | 14741 | |
14741 | 14742 | 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 @@ | |
14743 | 14744 | There are a lot of client-side hooks. |
14744 | 14745 | This section splits them into committing-workflow hooks, email-workflow scripts, and everything else. |
14745 | 14746 | |
14746 | 14747 | +[NOTE] |
14747 | -+==== | |
14748 | + ==== | |
14748 | 14749 | It's important to note that client-side hooks are *not* copied when you clone a repository. |
14749 | 14750 | -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 | +- | |
14750 | 14752 | +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 | + ==== | |
14752 | 14754 | |
14753 | 14755 | ===== Committing-Workflow Hooks |
14754 | - | |
14755 | -@@ -43,12 +47,13 @@ | |
14756 | +@@ -46,12 +47,13 @@ | |
14756 | 14757 | |
14757 | 14758 | 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. |
14758 | 14759 | 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 | ||
14767 | 14768 | ===== Email Workflow Hooks |
14768 | 14769 | |
14769 | 14770 | You can set up three client-side hooks for an email-based workflow. |
14770 | -@@ -69,6 +74,7 @@ | |
14771 | +@@ -72,6 +74,7 @@ | |
14771 | 14772 | You can use it to notify a group or the author of the patch you pulled in that you've done so. |
14772 | 14773 | You can't stop the patching process with this script. |
14773 | 14774 |
@@ -14775,26 +14776,7 @@ diff -au /tmp/book/08-customizing-git/sections/hooks.asc.tmp ../../git/progit2/p | ||
14775 | 14776 | ===== Other Client Hooks |
14776 | 14777 | |
14777 | 14778 | 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 @@ | |
14798 | 14780 | It takes the same stdin data as the `pre-receive` hook. |
14799 | 14781 | 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. |
14800 | 14782 | 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 | ||
14804 | 14786 | +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. |
14805 | 14787 | +==== |
14806 | 14788 | 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 | |
14808 | 14790 | +++ ../../git/progit2/progit2/book/08-customizing-git/sections/policy.asc 2020-07-04 16:36:46.738685634 +0900 |
14809 | 14791 | @@ -1,6 +1,7 @@ |
14810 | 14792 | -[[r_an_example_git_enforced_policy]] |
@@ -15215,7 +15197,7 @@ diff -au /tmp/book/08-customizing-git/sections/policy.asc.tmp ../../git/progit2/ | ||
15215 | 15197 | 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. |
15216 | 15198 | Warning: file not found: ../../git/progit2/progit2-ja/book/09-git-and-other-scms/sections/client-bzr.asc |
15217 | 15199 | 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 | |
15219 | 15201 | +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-hg.asc 2020-07-01 10:48:37.622009668 +0900 |
15220 | 15202 | @@ -1,5 +1,7 @@ |
15221 | 15203 | ==== Git and Mercurial |
@@ -15225,12 +15207,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15225 | 15207 | The DVCS universe is larger than just Git. |
15226 | 15208 | In fact, there are many other systems in this space, each with their own angle on how to do distributed version control correctly. |
15227 | 15209 | 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 @@ | |
15234 | 15211 | First, you need to install git-remote-hg. |
15235 | 15212 | This basically entails dropping its file somewhere in your path, like so: |
15236 | 15213 |
@@ -15269,7 +15246,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15269 | 15246 | ===== Getting Started |
15270 | 15247 | |
15271 | 15248 | 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 @@ | |
15273 | 15250 | |
15274 | 15251 | As always with Git, first we clone: |
15275 | 15252 |
@@ -15285,7 +15262,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15285 | 15262 | You'll notice that working with a Mercurial repository uses the standard `git clone` command. |
15286 | 15263 | 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). |
15287 | 15264 | 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 @@ | |
15289 | 15266 | It turns out some of these aren't actually there. |
15290 | 15267 | Let's take a look at what's actually in the `.git` directory: |
15291 | 15268 |
@@ -15314,7 +15291,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15314 | 15291 | 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. |
15315 | 15292 | The `refs/hg` directory is where the actual remote refs are stored. |
15316 | 15293 | 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 @@ | |
15318 | 15295 | The `notes/hg` file is the starting point for how git-remote-hg maps Git commit hashes to Mercurial changeset IDs. |
15319 | 15296 | Let's explore a bit: |
15320 | 15297 |
@@ -15341,7 +15318,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15341 | 15318 | So `refs/notes/hg` points to a tree, which in the Git object database is a list of other objects with names. |
15342 | 15319 | `git ls-tree` outputs the mode, type, object hash, and filename for items inside a tree. |
15343 | 15320 | 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 @@ | |
15345 | 15322 | 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. |
15346 | 15323 | 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: |
15347 | 15324 |
@@ -15353,7 +15330,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15353 | 15330 | The `.git/info/exclude` file acts just like a `.gitignore`, but isn't included in commits. |
15354 | 15331 | |
15355 | 15332 | ===== Workflow |
15356 | -@@ -65,19 +142,92 @@ | |
15333 | +@@ -67,19 +142,92 @@ | |
15357 | 15334 | 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. |
15358 | 15335 | Here's what our repository looks like right now: |
15359 | 15336 |
@@ -15446,7 +15423,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15446 | 15423 | 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. |
15447 | 15424 | |
15448 | 15425 | ===== Branches and Bookmarks |
15449 | -@@ -89,31 +239,158 @@ | |
15426 | +@@ -91,31 +239,158 @@ | |
15450 | 15427 | The branch that a changeset is made on is recorded _with the changeset_, which means it will always be in the repository history. |
15451 | 15428 | Here's an example of a commit that was made on the `develop` branch: |
15452 | 15429 |
@@ -15606,7 +15583,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-hg.asc.tmp ../../git/pr | ||
15606 | 15583 | |
15607 | 15584 | Git and Mercurial are similar enough that working across the boundary is fairly painless. |
15608 | 15585 | 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 | |
15610 | 15587 | +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/client-p4.asc 2020-07-04 16:36:46.740685658 +0900 |
15611 | 15588 | @@ -1,5 +1,7 @@ |
15612 | 15589 | ==== Git and Perforce |
@@ -15616,18 +15593,18 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15616 | 15593 | Perforce is a very popular version-control system in corporate environments. |
15617 | 15594 | It's been around since 1995, which makes it the oldest system covered in this chapter. |
15618 | 15595 | 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 @@ | |
15620 | 15597 | 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. |
15621 | 15598 | 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. |
15622 | 15599 | |
15623 | 15600 | +[[_p4_git_fusion]] |
15624 | -+===== Git Fusion | |
15625 | -+ | |
15601 | + ===== Git Fusion | |
15602 | + | |
15626 | 15603 | +(((Perforce, Git Fusion))) |
15627 | 15604 | 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. |
15628 | 15605 | |
15629 | 15606 | ====== Setting Up |
15630 | -@@ -19,14 +25,21 @@ | |
15607 | +@@ -21,14 +25,21 @@ | |
15631 | 15608 | 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. |
15632 | 15609 | When that has all completed, you'll see this: |
15633 | 15610 |
@@ -15651,7 +15628,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15651 | 15628 | The first one will open a VI editor to customize the user, but you can accept the defaults by typing `:wq` and hitting enter. |
15652 | 15629 | The second one will prompt you to enter a password twice. |
15653 | 15630 | 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 @@ | |
15655 | 15632 | 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. |
15656 | 15633 | 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: |
15657 | 15634 |
@@ -15679,7 +15656,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15679 | 15656 | The virtual-machine image comes equipped with a sample project that you can clone. |
15680 | 15657 | 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. |
15681 | 15658 | |
15682 | -@@ -46,21 +78,86 @@ | |
15659 | +@@ -48,21 +78,86 @@ | |
15683 | 15660 | 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. |
15684 | 15661 | The file structure looks like this: |
15685 | 15662 |
@@ -15766,7 +15743,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15766 | 15743 | This way, if your normal workspace mapping includes changes in the structure of the directories, you can replicate that with a Git repository. |
15767 | 15744 | |
15768 | 15745 | 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 @@ | |
15770 | 15747 | 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). |
15771 | 15748 | In most cases, this behavior will do just fine, but consider the following mapping file: |
15772 | 15749 |
@@ -15781,7 +15758,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15781 | 15758 | Each line is of the format `<user> <email> "<full name>"`, and creates a single user mapping. |
15782 | 15759 | The first two lines map two distinct email addresses to the same Perforce user account. |
15783 | 15760 | 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 @@ | |
15785 | 15762 | Let's have a look at how it feels to work from the Git side. |
15786 | 15763 | We'll assume we've mapped in the ``Jam'' project using a configuration file as shown above, which we can clone like this: |
15787 | 15764 |
@@ -15814,7 +15791,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15814 | 15791 | The first time you do this, it may take some time. |
15815 | 15792 | What's happening is that Git Fusion is converting all the applicable changesets in the Perforce history into Git commits. |
15816 | 15793 | 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 @@ | |
15818 | 15795 | There are three branches, and Git has helpfully created a local `master` branch that tracks `origin/master`. |
15819 | 15796 | Let's do a bit of work, and create a couple of new commits: |
15820 | 15797 |
@@ -15890,27 +15867,27 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15890 | 15867 | |
15891 | 15868 | 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. |
15892 | 15869 | 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 @@ | |
15894 | 15871 | |
15895 | 15872 | 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. |
15896 | 15873 | |
15897 | 15874 | +[[_git_p4_client]] |
15898 | -+===== Git-p4 | |
15899 | -+ | |
15875 | + ===== Git-p4 | |
15876 | + | |
15900 | 15877 | +(((git commands, p4))) |
15901 | 15878 | Git-p4 is a two-way bridge between Git and Perforce. |
15902 | 15879 | 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). |
15903 | 15880 | 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. |
15904 | 15881 | |
15905 | 15882 | +[NOTE] |
15906 | -+====== | |
15883 | + ====== | |
15907 | 15884 | You'll need the `p4` tool somewhere in your `PATH` to work with git-p4. |
15908 | 15885 | As of this writing, it is freely available at http://www.perforce.com/downloads/Perforce/20-User[]. |
15909 | -+====== | |
15886 | +- | |
15887 | + ====== | |
15910 | 15888 | |
15911 | 15889 | ====== Setting Up |
15912 | - | |
15913 | -@@ -140,18 +332,44 @@ | |
15890 | +@@ -147,18 +332,44 @@ | |
15914 | 15891 | |
15915 | 15892 | In order to use the `p4` command-line client (which git-p4 depends on), you'll need to set a couple of environment variables: |
15916 | 15893 |
@@ -15955,7 +15932,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
15955 | 15932 | No remotes exist in this repository at all. |
15956 | 15933 | 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. |
15957 | 15934 | |
15958 | -@@ -160,13 +378,51 @@ | |
15935 | +@@ -167,13 +378,51 @@ | |
15959 | 15936 | Okay, let's do some work. |
15960 | 15937 | 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. |
15961 | 15938 |
@@ -16007,7 +15984,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
16007 | 15984 | You can probably tell from the output, but `git p4 rebase` is a shortcut for `git p4 sync` followed by `git rebase p4/master`. |
16008 | 15985 | It's a bit smarter than that, especially when working with multiple branches, but this is a good approximation. |
16009 | 15986 | |
16010 | -@@ -174,50 +430,229 @@ | |
15987 | +@@ -181,50 +430,229 @@ | |
16011 | 15988 | The `git p4 submit` command will try to create a new Perforce revision for every Git commit between `p4/master` and `master`. |
16012 | 15989 | Running it drops us into our favorite editor, and the contents of the file look something like this: |
16013 | 15990 |
@@ -16239,9 +16216,9 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-p4.asc.tmp ../../git/pr | ||
16239 | 16216 | |
16240 | 16217 | 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`. |
16241 | 16218 | 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 | |
16243 | 16220 | +++ ../../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 @@ | |
16245 | 16222 | -[[r_git_svn]] |
16246 | 16223 | +[[_git_svn]] |
16247 | 16224 | ==== Git and Subversion |
@@ -16255,15 +16232,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16255 | 16232 | One of Git's great features is a bidirectional bridge to Subversion called `git svn`. |
16256 | 16233 | 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. |
16257 | 16234 | 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 @@ | |
16267 | 16236 | ===== Setting Up |
16268 | 16237 | |
16269 | 16238 | 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 | ||
16315 | 16284 | |
16316 | 16285 | 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. |
16317 | 16286 | 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 @@ | |
16319 | 16288 | You'll start with the `git svn clone` command, which imports an entire Subversion repository into a local Git repository. |
16320 | 16289 | 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: |
16321 | 16290 |
@@ -16346,7 +16315,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16346 | 16315 | For a project with hundreds or thousands of commits, this can literally take hours or even days to finish. |
16347 | 16316 | |
16348 | 16317 | 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 @@ | |
16350 | 16319 | Because this is so common, you can replace this entire part with `-s`, which means standard layout and implies all those options. |
16351 | 16320 | The following command is equivalent: |
16352 | 16321 |
@@ -16450,7 +16419,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16450 | 16419 | Notice that the SHA-1 checksum that originally started with `4af61fd` when you committed now begins with `95e0222`. |
16451 | 16420 | 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. |
16452 | 16421 | |
16453 | -@@ -89,13 +214,75 @@ | |
16422 | +@@ -91,13 +214,75 @@ | |
16454 | 16423 | That change will be rejected until you merge in their work. |
16455 | 16424 | In `git svn`, it looks like this: |
16456 | 16425 |
@@ -16526,7 +16495,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16526 | 16495 | This is important to remember, because the outcome is a project state that didn't exist on either of your computers when you pushed. |
16527 | 16496 | If the changes are incompatible but don't conflict, you may get issues that are difficult to diagnose. |
16528 | 16497 | 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 @@ | |
16530 | 16499 | You should also run this command to pull in changes from the Subversion server, even if you're not ready to commit yourself. |
16531 | 16500 | You can run `git svn fetch` to grab the new data, but `git svn rebase` does the fetch and then updates your local commits. |
16532 | 16501 |
@@ -16542,7 +16511,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16542 | 16511 | Running `git svn rebase` every once in a while makes sure your code is always up to date. |
16543 | 16512 | You need to be sure your working directory is clean when you run this, though. |
16544 | 16513 | 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 @@ | |
16546 | 16515 | Suppose your history looks like the following: you created an `experiment` branch, did two commits, and then merged them back into `master`. |
16547 | 16516 | When you `dcommit`, you see output like this: |
16548 | 16517 |
@@ -16567,7 +16536,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16567 | 16536 | 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. |
16568 | 16537 | |
16569 | 16538 | 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 @@ | |
16571 | 16540 | ===== Subversion Branching |
16572 | 16541 | |
16573 | 16542 | 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 | ||
16592 | 16561 | |
16593 | 16562 | This does the equivalent of the `svn copy trunk branches/opera` command in Subversion and operates on the Subversion server. |
16594 | 16563 | 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 @@ | |
16596 | 16565 | 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. |
16597 | 16566 | |
16598 | 16567 | 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 | ||
16606 | 16575 | |
16607 | 16576 | Now, if you want to merge your `opera` branch into `trunk` (your `master` branch), you can do so with a normal `git merge`. |
16608 | 16577 | 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 @@ | |
16610 | 16579 | 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. |
16611 | 16580 | 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. |
16612 | 16581 | 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 | ||
16615 | 16584 | 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. |
16616 | 16585 | To avoid issues, you should delete the local branch (in this case, `opera`) after you merge it into trunk. |
16617 | 16586 | |
16618 | -@@ -158,6 +388,25 @@ | |
16587 | +@@ -160,6 +388,25 @@ | |
16619 | 16588 | |
16620 | 16589 | 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: |
16621 | 16590 |
@@ -16641,7 +16610,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16641 | 16610 | You should know two important things about `git svn log`. |
16642 | 16611 | First, it works offline, unlike the real `svn log` command, which asks the Subversion server for the data. |
16643 | 16612 | 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 @@ | |
16645 | 16614 | 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]`. |
16646 | 16615 | The output looks like this: |
16647 | 16616 |
@@ -16686,7 +16655,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16686 | 16655 | 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. |
16687 | 16656 | |
16688 | 16657 | ====== Ignoring What Subversion Ignores |
16689 | -@@ -185,6 +466,11 @@ | |
16658 | +@@ -187,6 +466,11 @@ | |
16690 | 16659 | |
16691 | 16660 | 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: |
16692 | 16661 |
@@ -16700,7 +16669,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/client-svn.asc.tmp ../../git/p | ||
16700 | 16669 | |
16701 | 16670 | Warning: file not found: ../../git/progit2/progit2-ja/book/09-git-and-other-scms/sections/import-bzr.asc |
16702 | 16671 | 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 | |
16704 | 16673 | +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-custom.asc 2020-06-28 16:44:50.946018445 +0900 |
16705 | 16674 | @@ -1,4 +1,4 @@ |
16706 | 16675 | -[[r_custom_importer]] |
@@ -16708,7 +16677,7 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp ../../gi | ||
16708 | 16677 | ==== A Custom Importer |
16709 | 16678 | |
16710 | 16679 | (((git commands, fast-import))) |
16711 | -@@ -14,82 +14,359 @@ | |
16680 | +@@ -14,85 +14,359 @@ | |
16712 | 16681 | 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. |
16713 | 16682 | Your directory structure looks like this: |
16714 | 16683 |
@@ -16890,18 +16859,18 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-custom.asc.tmp ../../gi | ||
16890 | 16859 | +---- |
16891 | 16860 | + |
16892 | 16861 | +[NOTE] |
16893 | -+==== | |
16862 | + ==== | |
16894 | 16863 | If you are running on Windows you'll need to make sure that you add one extra step. |
16895 | 16864 | -As mentioned before, Windows uses CRLF for new line characters while git fast-import expects only LF. |
16896 | 16865 | -To get around this problem and make git fast-import happy, you need to tell ruby to use LF instead of CRLF: |
16897 | 16866 | +As mentioned before, Windows uses CRLF for new line characters while `git fast-import` expects only LF. |
16898 | 16867 | +To get around this problem and make `git fast-import` happy, you need to tell ruby to use LF instead of CRLF: |
16899 | -+ | |
16868 | + | |
16900 | 16869 | +[source,ruby] |
16901 | 16870 | +---- |
16902 | 16871 | +$stdout.binmode |
16903 | 16872 | +---- |
16904 | -+==== | |
16873 | + ==== | |
16905 | 16874 | |
16906 | 16875 | That's it. |
16907 | 16876 | 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 | ||
17073 | 17042 | 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. |
17074 | 17043 | A number of examples of more complex scenarios are available in the `contrib/fast-import` directory of the Git source code. |
17075 | 17044 | 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 | |
17077 | 17046 | +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-hg.asc 2020-06-28 16:44:50.947018592 +0900 |
17078 | 17047 | @@ -3,25 +3,122 @@ |
17079 | 17048 | (((Mercurial)))(((Importing, from Mercurial))) |
@@ -17201,19 +17170,17 @@ diff -au /tmp/book/09-git-and-other-scms/sections/import-hg.asc.tmp ../../git/pr | ||
17201 | 17170 | +$ git push origin --all |
17202 | 17171 | +---- |
17203 | 17172 | 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 | |
17205 | 17174 | +++ ../../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 @@ | |
17207 | 17176 | -[[r_perforce_import]] |
17208 | 17177 | +[[_perforce_import]] |
17209 | 17178 | ==== Perforce |
17210 | 17179 | |
17211 | 17180 | (((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 | |
17214 | 17183 | |
17215 | -+===== Perforce Git Fusion | |
17216 | -+ | |
17217 | 17184 | Git Fusion makes this process fairly painless. |
17218 | 17185 | -Just configure your project settings, user mappings, and branches using a configuration file (as discussed in <<r_p4_git_fusion>>), and clone the repository. |
17219 | 17186 | +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 | ||
17223 | 17190 | +[[_git_p4]] |
17224 | 17191 | ===== Git-p4 |
17225 | 17192 | |
17193 | +-===== git-p4 | |
17194 | +- | |
17226 | 17195 | Git-p4 can also act as an import tool. |
17227 | 17196 | As an example, we'll import the Jam project from the Perforce Public Depot. |
17228 | 17197 | 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 | ||
17233 | 17202 | +---- |
17234 | 17203 | + |
17235 | 17204 | +[NOTE] |
17236 | -+==== | |
17205 | + ==== | |
17237 | 17206 | In order to follow along, you'll need a Perforce depot to connect with. |
17238 | 17207 | 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 | + ==== | |
17240 | 17210 | |
17241 | 17211 | +(((git commands, p4))) |
17242 | 17212 | 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 | ||
17310 | 17280 | + |
17311 | 17281 | Your import is ready to push up to your new Git server. |
17312 | 17282 | 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 | |
17314 | 17284 | +++ ../../git/progit2/progit2/book/09-git-and-other-scms/sections/import-svn.asc 2020-07-04 16:36:46.743685694 +0900 |
17315 | 17285 | @@ -12,21 +12,76 @@ |
17316 | 17286 | 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 | ||
17451 | 17421 | + |
17452 | 17422 | All your branches and tags should be on your new Git server in a nice, clean import. |
17453 | 17423 | 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 | |
17455 | 17425 | +++ ../../git/progit2/progit2/book/10-git-internals/sections/environment.asc 2020-07-01 10:48:37.623009671 +0900 |
17456 | 17426 | @@ -4,6 +4,7 @@ |
17457 | 17427 | 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 | ||
17478 | 17448 | |
17479 | 17449 | *`GIT_INDEX_FILE`* is the path to the index file (non-bare repositories only). |
17480 | 17450 | |
17481 | -@@ -46,12 +48,13 @@ | |
17451 | +@@ -46,14 +48,13 @@ | |
17482 | 17452 | *`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`. |
17483 | 17453 | 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. |
17484 | 17454 | |
17485 | -+ | |
17486 | - ==== Pathspecs | |
17455 | +-==== Pathspecs | |
17456 | + | |
17457 | +-==== Pathspec | |
17458 | ++==== Pathspecs | |
17487 | 17459 | |
17488 | 17460 | A ``pathspec'' refers to how you specify paths to things in Git, including the use of wildcards. |
17489 | 17461 | 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 | ||
17493 | 17465 | 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`. |
17494 | 17466 | You can override this in individual cases by starting the pathspec with `:(glob)` or `:(literal)`, as in `:(glob)*.c`. |
17495 | 17467 | |
17496 | -@@ -59,6 +62,7 @@ | |
17468 | +@@ -61,6 +62,7 @@ | |
17497 | 17469 | |
17498 | 17470 | *`GIT_ICASE_PATHSPECS`* sets all pathspecs to work in a case-insensitive manner. |
17499 | 17471 |
@@ -17501,7 +17473,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi | ||
17501 | 17473 | ==== Committing |
17502 | 17474 | |
17503 | 17475 | 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 @@ | |
17505 | 17477 | *`EMAIL`* is the fallback email address in case the `user.email` configuration value isn't set. |
17506 | 17478 | If _this_ isn't set, Git falls back to the system user and host names. |
17507 | 17479 |
@@ -17509,7 +17481,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi | ||
17509 | 17481 | ==== Networking |
17510 | 17482 | |
17511 | 17483 | 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 @@ | |
17513 | 17485 | *`GIT_SSL_NO_VERIFY`* tells Git not to verify SSL certificates. |
17514 | 17486 | 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. |
17515 | 17487 |
@@ -17524,7 +17496,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi | ||
17524 | 17496 | ==== Diffing and Merging |
17525 | 17497 | |
17526 | 17498 | *`GIT_DIFF_OPTS`* is a bit of a misnomer. |
17527 | -@@ -127,16 +134,84 @@ | |
17499 | +@@ -129,16 +134,84 @@ | |
17528 | 17500 | *`GIT_TRACE`* controls general traces, which don't fit into any specific category. |
17529 | 17501 | This includes the expansion of aliases, and delegation to other sub-programs. |
17530 | 17502 |
@@ -17610,7 +17582,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi | ||
17610 | 17582 | ==== Miscellaneous |
17611 | 17583 | |
17612 | 17584 | *`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 @@ | |
17614 | 17586 | It's probably easier just to use the `~/.ssh/config` file for that. |
17615 | 17587 | |
17616 | 17588 | *`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 | ||
17620 | 17592 | |
17621 | 17593 | *`GIT_NAMESPACE`* controls access to namespaced refs, and is equivalent to the `--namespace` flag. |
17622 | 17594 | 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 @@ | |
17624 | 17596 | |
17625 | 17597 | *`GIT_REFLOG_ACTION`* lets you specify the descriptive text written to the reflog. |
17626 | 17598 | Here's an example: |
@@ -17633,7 +17605,7 @@ diff -au /tmp/book/10-git-internals/sections/environment.asc.tmp ../../git/progi | ||
17633 | 17605 | +9e3d55a HEAD@{0}: my action: My message |
17634 | 17606 | +---- |
17635 | 17607 | 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 | |
17637 | 17609 | +++ ../../git/progit2/progit2/book/10-git-internals/sections/maintenance.asc 2020-06-28 16:44:50.948018739 +0900 |
17638 | 17610 | @@ -3,6 +3,7 @@ |
17639 | 17611 | 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 | ||
17972 | 17944 | +size-garbage: 0 |
17973 | 17945 | +---- |
17974 | 17946 | 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 | |
17976 | 17948 | +++ ../../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 @@ | |
17978 | 17950 | -[[r_objects]] |
17979 | 17951 | +[[_objects]] |
17980 | 17952 | === Git Objects |
@@ -18007,7 +17979,11 @@ diff -au /tmp/book/10-git-internals/sections/objects.asc.tmp ../../git/progit2/p | ||
18007 | 17979 | Git has initialized the `objects` directory and created `pack` and `info` subdirectories in it, but there are no regular files. |
18008 | 17980 | -Now, store some text in your Git database: |
18009 | 17981 | +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. | |
18011 | 17987 | +[source,console] |
18012 | 17988 | +---- |
18013 | 17989 | +$ 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 | ||
18017 | 17993 | +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. |
18018 | 17994 | +The `-w` option then tells the command to not simply return the key, but to write that object to the database. |
18019 | 17995 | +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 | ++ | |
18025 | 17997 | +The output from the above command is a 40-character checksum hash. |
18026 | 17998 | +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. |
18027 | 17999 | 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 | ||
18285 | 18257 | +tree d8329fc1cc938780ffdd9f94e0d364e0ea74f579 |
18286 | 18258 | +author Scott Chacon <schacon@gmail.com> 1243040974 -0700 |
18287 | 18259 | +committer Scott Chacon <schacon@gmail.com> 1243040974 -0700 |
18288 | -+ | |
18289 | -+First commit | |
18290 | -+---- | |
18291 | 18260 | |
18292 | 18261 | -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 | ++ | |
18293 | 18265 | +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. |
18294 | 18266 | |
18295 | 18267 | 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 | ||
18378 | 18350 | |
18379 | 18351 | You can start up interactive Ruby mode with the `irb` command: |
18380 | 18352 | |
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: | |
18383 | 18353 | +[source,console] |
18384 | 18354 | +---- |
18385 | 18355 | +$ irb |
18386 | 18356 | +>> 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: | |
18388 | 18360 | +---- |
18389 | 18361 | + |
18390 | 18362 | +Git first constructs a header which starts by identifying the type of object -- in this case, a blob. |
18391 | 18363 | +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 | + | |
18393 | 18365 | +[source,console] |
18394 | 18366 | +---- |
18395 | 18367 | +>> header = "blob #{content.bytesize}\0" |
18396 | -+=> "blob 16\u0000" | |
18368 | + => "blob 16\u0000" | |
18397 | 18369 | +---- |
18398 | - | |
18370 | ++ | |
18399 | 18371 | Git concatenates the header and the original content and then calculates the SHA-1 checksum of that new content. |
18400 | 18372 | 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: |
18401 | 18373 | |
18402 | 18374 | +[source,console] |
18403 | 18375 | +---- |
18404 | 18376 | +>> store = header + content |
18405 | -+=> "blob 16\u0000what is up, doc?" | |
18377 | + => "blob 16\u0000what is up, doc?" | |
18406 | 18378 | +>> require 'digest/sha1' |
18407 | -+=> true | |
18379 | + => true | |
18408 | 18380 | +>> sha1 = Digest::SHA1.hexdigest(store) |
18409 | -+=> "bd9dbf5aae1a3862dd1526723246b20206e5fc37" | |
18381 | + => "bd9dbf5aae1a3862dd1526723246b20206e5fc37" | |
18410 | 18382 | +---- |
18411 | 18383 | + |
18412 | 18384 | +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 | ||
18424 | 18396 | +[source,console] |
18425 | 18397 | +---- |
18426 | 18398 | +>> require 'zlib' |
18427 | -+=> true | |
18399 | + => true | |
18428 | 18400 | +>> 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" | |
18430 | 18402 | +---- |
18431 | 18403 | + |
18432 | 18404 | 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 | ||
18437 | 18409 | +[source,console] |
18438 | 18410 | +---- |
18439 | 18411 | +>> path = '.git/objects/' + sha1[0,2] + '/' + sha1[2,38] |
18440 | -+=> ".git/objects/bd/9dbf5aae1a3862dd1526723246b20206e5fc37" | |
18412 | + => ".git/objects/bd/9dbf5aae1a3862dd1526723246b20206e5fc37" | |
18441 | 18413 | +>> require 'fileutils' |
18442 | -+=> true | |
18414 | + => true | |
18443 | 18415 | +>> FileUtils.mkdir_p(File.dirname(path)) |
18444 | -+=> ".git/objects/bd" | |
18416 | + => ".git/objects/bd" | |
18445 | 18417 | +>> File.open(path, 'w') { |f| f.write zlib_content } |
18446 | -+=> 32 | |
18418 | + => 32 | |
18447 | 18419 | +---- |
18448 | 18420 | + |
18449 | 18421 | +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 | ||
18459 | 18431 | 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. |
18460 | 18432 | Also, although the blob content can be nearly anything, the commit and tree content are very specifically formatted. |
18461 | 18433 | 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 | |
18463 | 18435 | +++ ../../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 @@ | |
18465 | 18437 | === Packfiles |
18466 | 18438 | |
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 | |
18469 | 18440 | +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: |
18470 | 18441 | |
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: | |
18478 | 18444 | +[source,console] |
18479 | 18445 | +---- |
18480 | 18446 | +$ find .git/objects -type f |
@@ -18491,11 +18457,18 @@ diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2 | ||
18491 | 18457 | +.git/objects/fd/f4fc3344e67ab068f836878b6c4951e3b15f3d # commit 1 |
18492 | 18458 | +---- |
18493 | 18459 | |
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: | |
18496 | 18463 | +Now you'll add some more sizable content to the repository to demonstrate an interesting feature of Git. |
18497 | 18464 | +To demonstrate, we'll add the `repo.rb` file from the Grit library -- this is about a 22K source code file: |
18498 | 18465 | |
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 | +- | |
18499 | 18472 | -Check the tree created by that commit, and you see something interesting: |
18500 | 18473 | +[source,console] |
18501 | 18474 | +---- |
@@ -18561,7 +18534,7 @@ diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2 | ||
18561 | 18534 | 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? |
18562 | 18535 | |
18563 | 18536 | It turns out that it can. |
18564 | -@@ -26,25 +90,74 @@ | |
18537 | +@@ -28,25 +90,74 @@ | |
18565 | 18538 | 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. |
18566 | 18539 | To see what happens, you can manually ask Git to pack up the objects by calling the `git gc` command: |
18567 | 18540 |
@@ -18643,7 +18616,7 @@ diff -au /tmp/book/10-git-internals/sections/packfiles.asc.tmp ../../git/progit2 | ||
18643 | 18616 | The really nice thing about this is that it can be repacked at any time. |
18644 | 18617 | 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. |
18645 | 18618 | 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 | |
18647 | 18620 | +++ ../../git/progit2/progit2/book/10-git-internals/sections/plumbing-porcelain.asc 2020-06-28 16:44:50.950019034 +0900 |
18648 | 18621 | @@ -1,25 +1,37 @@ |
18649 | 18622 | -[[r_plumbing_porcelain]] |
@@ -18696,9 +18669,9 @@ diff -au /tmp/book/10-git-internals/sections/plumbing-porcelain.asc.tmp ../../gi | ||
18696 | 18669 | +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. |
18697 | 18670 | You'll now look at each of these sections in detail to see how Git operates. |
18698 | 18671 | 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 | |
18700 | 18673 | +++ ../../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 @@ | |
18702 | 18675 | -[[r_git_refs]] |
18703 | 18676 | +[[_git_refs]] |
18704 | 18677 | === Git References |
@@ -18777,6 +18750,8 @@ diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/prog | ||
18777 | 18750 | +[[ref_the_ref]] |
18778 | 18751 | ==== The HEAD |
18779 | 18752 | |
18753 | +-==== HEAD | |
18754 | +- | |
18780 | 18755 | -The question now is, when you run `git branch (branchname)`, how does Git know the SHA-1 of the last commit? |
18781 | 18756 | +The question now is, when you run `git branch <branch>`, how does Git know the SHA-1 of the last commit? |
18782 | 18757 | The answer is the HEAD file. |
@@ -18903,7 +18878,7 @@ diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/prog | ||
18903 | 18878 | |
18904 | 18879 | ==== Remotes |
18905 | 18880 | |
18906 | -@@ -78,8 +184,26 @@ | |
18881 | +@@ -80,8 +184,26 @@ | |
18907 | 18882 | 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. |
18908 | 18883 | For instance, you can add a remote called `origin` and push your `master` branch to it: |
18909 | 18884 |
@@ -18931,13 +18906,15 @@ diff -au /tmp/book/10-git-internals/sections/refs.asc.tmp ../../git/progit2/prog | ||
18931 | 18906 | You can `git checkout` to one, but Git won't point HEAD at one, so you'll never update it with a `commit` command. |
18932 | 18907 | Git manages them as bookmarks to the last known state of where those branches were on those servers. |
18933 | 18908 | 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 | |
18935 | 18910 | +++ ../../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 @@ | |
18937 | 18912 | -[[r_refspec]] |
18938 | 18913 | +[[_refspec]] |
18939 | 18914 | === The Refspec |
18940 | 18915 | |
18916 | +-=== Refspec | |
18917 | +- | |
18941 | 18918 | Throughout this book, we've used simple mappings from remote branches to local references, but they can be more complex. |
18942 | 18919 | -Suppose you add a remote like this: |
18943 | 18920 | +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 | ||
19094 | 19071 | +$ git push origin --delete topic |
19095 | 19072 | +---- |
19096 | 19073 | 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 | |
19098 | 19075 | +++ ../../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 @@ | |
19100 | 19077 | If you're setting up a repository to be served read-only over HTTP, the dumb protocol is likely what will be used. |
19101 | 19078 | 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. |
19102 | 19079 |
@@ -19104,8 +19081,12 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19104 | 19081 | ==== |
19105 | 19082 | The dumb protocol is fairly rarely used these days. |
19106 | 19083 | 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 | + ==== | |
19108 | 19086 | |
19087 | +-==== | |
19088 | +-==== | |
19089 | +- | |
19109 | 19090 | Let's follow the `http-fetch` process for the simplegit library: |
19110 | 19091 | |
19111 | 19092 | +[source,console] |
@@ -19118,7 +19099,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19118 | 19099 | |
19119 | 19100 | +[source] |
19120 | 19101 | +---- |
19121 | -+=> GET info/refs | |
19102 | + => GET info/refs | |
19122 | 19103 | +ca82a6dff817ec66f44342007202690a93763949 refs/heads/master |
19123 | 19104 | +---- |
19124 | 19105 | + |
@@ -19127,7 +19108,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19127 | 19108 | |
19128 | 19109 | +[source] |
19129 | 19110 | +---- |
19130 | -+=> GET HEAD | |
19111 | + => GET HEAD | |
19131 | 19112 | +ref: refs/heads/master |
19132 | 19113 | +---- |
19133 | 19114 | + |
@@ -19137,7 +19118,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19137 | 19118 | |
19138 | 19119 | +[source] |
19139 | 19120 | +---- |
19140 | -+=> GET objects/ca/82a6dff817ec66f44342007202690a93763949 | |
19121 | + => GET objects/ca/82a6dff817ec66f44342007202690a93763949 | |
19141 | 19122 | +(179 bytes of binary data) |
19142 | 19123 | +---- |
19143 | 19124 | + |
@@ -19159,7 +19140,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19159 | 19140 | |
19160 | 19141 | +[source] |
19161 | 19142 | +---- |
19162 | -+=> GET objects/08/5bb3bcb608e1e8451d4b2432f8ecbe6306e7e7 | |
19143 | + => GET objects/08/5bb3bcb608e1e8451d4b2432f8ecbe6306e7e7 | |
19163 | 19144 | +(179 bytes of data) |
19164 | 19145 | +---- |
19165 | 19146 | + |
@@ -19168,7 +19149,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19168 | 19149 | |
19169 | 19150 | +[source] |
19170 | 19151 | +---- |
19171 | -+=> GET objects/cf/da3bf379e4f8dba8717dee55aab78aef7f4daf | |
19152 | + => GET objects/cf/da3bf379e4f8dba8717dee55aab78aef7f4daf | |
19172 | 19153 | +(404 - Not Found) |
19173 | 19154 | +---- |
19174 | 19155 | + |
@@ -19178,7 +19159,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19178 | 19159 | |
19179 | 19160 | +[source] |
19180 | 19161 | +---- |
19181 | -+=> GET objects/info/http-alternates | |
19162 | + => GET objects/info/http-alternates | |
19182 | 19163 | +(empty file) |
19183 | 19164 | +---- |
19184 | 19165 | + |
@@ -19188,7 +19169,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19188 | 19169 | |
19189 | 19170 | +[source] |
19190 | 19171 | +---- |
19191 | -+=> GET objects/info/packs | |
19172 | + => GET objects/info/packs | |
19192 | 19173 | +P pack-816a9b2334da9953e530f27bcac22082a9f5b835.pack |
19193 | 19174 | +---- |
19194 | 19175 | + |
@@ -19197,7 +19178,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19197 | 19178 | |
19198 | 19179 | +[source] |
19199 | 19180 | +---- |
19200 | -+=> GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.idx | |
19181 | + => GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.idx | |
19201 | 19182 | +(4k of binary data) |
19202 | 19183 | +---- |
19203 | 19184 | + |
@@ -19206,14 +19187,14 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19206 | 19187 | |
19207 | 19188 | +[source] |
19208 | 19189 | +---- |
19209 | -+=> GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.pack | |
19190 | + => GET objects/pack/pack-816a9b2334da9953e530f27bcac22082a9f5b835.pack | |
19210 | 19191 | +(13k of binary data) |
19211 | 19192 | +---- |
19212 | 19193 | + |
19213 | 19194 | You have your tree object, so you continue walking your commits. |
19214 | 19195 | They're all also within the packfile you just downloaded, so you don't have to do any more requests to your server. |
19215 | 19196 | 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 @@ | |
19217 | 19198 | |
19218 | 19199 | ===== Uploading Data |
19219 | 19200 |
@@ -19221,9 +19202,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19221 | 19202 | To upload data to a remote process, Git uses the `send-pack` and `receive-pack` processes. |
19222 | 19203 | The `send-pack` process runs on the client and connects to a `receive-pack` process on the remote side. |
19223 | 19204 | |
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 @@ | |
19227 | 19206 | Git fires up the `send-pack` process, which initiates a connection over SSH to your server. |
19228 | 19207 | It tries to run a command on the remote server via an SSH call that looks something like this: |
19229 | 19208 |
@@ -19264,7 +19243,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19264 | 19243 | 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. |
19265 | 19244 | The first line also has the client's capabilities. |
19266 | 19245 | 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 @@ | |
19268 | 19247 | Next, the client sends a packfile of all the objects the server doesn't have yet. |
19269 | 19248 | Finally, the server responds with a success (or failure) indication: |
19270 | 19249 |
@@ -19273,14 +19252,14 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19273 | 19252 | +000eunpack ok |
19274 | 19253 | +---- |
19275 | 19254 | + |
19276 | -+====== HTTP(S) | |
19277 | -+ | |
19255 | + ====== HTTP(S) | |
19256 | + | |
19278 | 19257 | This process is mostly the same over HTTP, though the handshaking is a bit different. |
19279 | 19258 | The connection is initiated with this request: |
19280 | 19259 | |
19281 | 19260 | +[source] |
19282 | 19261 | +---- |
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 | |
19284 | 19263 | +001f# service=git-receive-pack |
19285 | 19264 | +00ab6c5f0e45abd7832bf23074a333f739977c9e8188 refs/heads/master□report-status \ |
19286 | 19265 | + 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 | ||
19293 | 19272 | |
19294 | 19273 | +[source] |
19295 | 19274 | +---- |
19296 | -+=> POST http://server/simplegit-progit.git/git-receive-pack | |
19275 | + => POST http://server/simplegit-progit.git/git-receive-pack | |
19297 | 19276 | +---- |
19298 | 19277 | + |
19299 | 19278 | 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 | ||
19307 | 19286 | When you download data, the `fetch-pack` and `upload-pack` processes are involved. |
19308 | 19287 | 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. |
19309 | 19288 | |
19310 | -+====== SSH | |
19311 | -+ | |
19289 | +@@ -122,8 +223,23 @@ | |
19290 | + | |
19312 | 19291 | If you're doing the fetch over SSH, `fetch-pack` runs something like this: |
19313 | 19292 | |
19314 | 19293 | +[source,console] |
@@ -19331,7 +19310,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19331 | 19310 | This is very similar to what `receive-pack` responds with, but the capabilities are different. |
19332 | 19311 | 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. |
19333 | 19312 | |
19334 | -@@ -111,11 +247,41 @@ | |
19313 | +@@ -131,15 +247,41 @@ | |
19335 | 19314 | It sends all the objects it already has with ``have'' and then the SHA-1. |
19336 | 19315 | 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: |
19337 | 19316 |
@@ -19343,14 +19322,14 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19343 | 19322 | +0000 |
19344 | 19323 | +---- |
19345 | 19324 | + |
19346 | -+====== HTTP(S) | |
19347 | -+ | |
19325 | + ====== HTTP(S) | |
19326 | + | |
19348 | 19327 | The handshake for a fetch operation takes two HTTP requests. |
19349 | 19328 | The first is a `GET` to the same endpoint used in the dumb protocol: |
19350 | 19329 | |
19351 | 19330 | +[source] |
19352 | 19331 | +---- |
19353 | -+=> GET $GIT_URL/info/refs?service=git-upload-pack | |
19332 | + => GET $GIT_URL/info/refs?service=git-upload-pack | |
19354 | 19333 | +001e# service=git-upload-pack |
19355 | 19334 | +00e7ca82a6dff817ec66f44342007202690a93763949 HEAD□multi_ack thin-pack \ |
19356 | 19335 | + 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 | ||
19364 | 19343 | |
19365 | 19344 | +[source] |
19366 | 19345 | +---- |
19367 | -+=> POST $GIT_URL/git-upload-pack HTTP/1.0 | |
19346 | + => POST $GIT_URL/git-upload-pack HTTP/1.0 | |
19368 | 19347 | +0032want 0a53e9ddeaddad63ad106860237bbf53411d11a7 |
19369 | 19348 | +0032have 441b40d833fdfa93eb2908e52742248faf0ee993 |
19370 | 19349 | +0000 |
@@ -19374,7 +19353,7 @@ diff -au /tmp/book/10-git-internals/sections/transfer-protocols.asc.tmp ../../gi | ||
19374 | 19353 | The response to this request indicates success or failure, and includes the packfile. |
19375 | 19354 | |
19376 | 19355 | 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 | |
19378 | 19357 | +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/bash.asc 2020-07-04 16:36:46.743685694 +0900 |
19379 | 19358 | @@ -1,12 +1,23 @@ |
19380 | 19359 | === Git in Bash |
@@ -19422,7 +19401,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/bash.asc.tmp ../../git/p | ||
19422 | 19401 | |
19423 | 19402 | 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. |
19424 | 19403 | 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 | |
19426 | 19405 | +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/guis.asc 2020-07-04 16:36:46.743685694 +0900 |
19427 | 19406 | @@ -1,5 +1,6 @@ |
19428 | 19407 | === Graphical Interfaces |
@@ -19509,8 +19488,13 @@ diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/p | ||
19509 | 19488 | * 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. |
19510 | 19489 | * The last thing to notice is the ``Sync'' button at the top-right, which is the primary way you interact over the network. |
19511 | 19490 | |
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 | + ==== | |
19513 | 19494 | |
19495 | +-==== | |
19496 | +-==== | |
19497 | +- | |
19514 | 19498 | ===== Installation |
19515 | 19499 | |
19516 | 19500 | -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 | ||
19524 | 19508 | |
19525 | 19509 | The next step is to give the tool some repositories to work with. |
19526 | 19510 | 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 @@ | |
19528 | 19512 | |
19529 | 19513 | Once it's installed and configured, you can use the GitHub client for many common Git tasks. |
19530 | 19514 | 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 | ||
19549 | 19533 | |
19550 | 19534 | Once your branch is created, making new commits is fairly straightforward. |
19551 | 19535 | 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 @@ | |
19553 | 19537 | 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. |
19554 | 19538 | 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. |
19555 | 19539 |
@@ -19562,7 +19546,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/guis.asc.tmp ../../git/p | ||
19562 | 19546 | 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[]. |
19563 | 19547 | Warning: file not found: ../../git/progit2/progit2-ja/book/A-git-in-other-environments/sections/jetbrainsides.asc |
19564 | 19548 | 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 | |
19566 | 19550 | +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/powershell.asc 2020-07-04 16:36:46.743685694 +0900 |
19567 | 19551 | @@ -1,16 +1,86 @@ |
19568 | 19552 | -[[r_git_powershell]] |
@@ -19663,7 +19647,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/powershell.asc.tmp ../.. | ||
19663 | 19647 | +For more details on how to customize your posh-git prompt see: https://github.com/dahlbyk/posh-git/blob/master/README.md#customization-variables[]. |
19664 | 19648 | Warning: file not found: ../../git/progit2/progit2-ja/book/A-git-in-other-environments/sections/sublimetext.asc |
19665 | 19649 | 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 | |
19667 | 19651 | +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/visualstudio.asc 2020-07-13 09:35:20.947908596 +0900 |
19668 | 19652 | @@ -1,5 +1,6 @@ |
19669 | 19653 | === Git in Visual Studio |
@@ -19700,7 +19684,7 @@ diff -au /tmp/book/A-git-in-other-environments/sections/visualstudio.asc.tmp ../ | ||
19700 | 19684 | +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[]. |
19701 | 19685 | Warning: file not found: ../../git/progit2/progit2-ja/book/A-git-in-other-environments/sections/visualstudiocode.asc |
19702 | 19686 | 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 | |
19704 | 19688 | +++ ../../git/progit2/progit2/book/A-git-in-other-environments/sections/zsh.asc 2020-07-04 16:36:46.743685694 +0900 |
19705 | 19689 | @@ -1,34 +1,55 @@ |
19706 | 19690 | === Git in Zsh |
@@ -19773,9 +19757,9 @@ diff -au /tmp/book/B-embedding-git/sections/command-line.asc.tmp ../../git/progi | ||
19773 | 19757 | Warning: file not found: ../../git/progit2/progit2-ja/book/B-embedding-git/sections/dulwich.asc |
19774 | 19758 | Warning: file not found: ../../git/progit2/progit2-ja/book/B-embedding-git/sections/go-git.asc |
19775 | 19759 | 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 | |
19777 | 19761 | +++ ../../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 @@ | |
19779 | 19763 | === JGit |
19780 | 19764 | |
19781 | 19765 | -(((jgit)))(((java))) |
@@ -19813,11 +19797,10 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi | ||
19813 | 19797 | +java -cp .:org.eclipse.jgit-3.5.0.201409260305-r.jar App |
19814 | 19798 | +---- |
19815 | 19799 | + |
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 | |
19820 | 19801 | |
19802 | + JGit has two basic levels of API: plumbing and porcelain. | |
19803 | +@@ -24,6 +39,7 @@ | |
19821 | 19804 | 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. |
19822 | 19805 | For a filesystem-based repository (yes, JGit allows for other storage models), this is accomplished using `FileRepositoryBuilder`: |
19823 | 19806 |
@@ -19825,7 +19808,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi | ||
19825 | 19808 | ---- |
19826 | 19809 | // Create a new repository |
19827 | 19810 | Repository newlyCreatedRepo = FileRepositoryBuilder.create( |
19828 | -@@ -40,6 +58,7 @@ | |
19811 | +@@ -42,6 +58,7 @@ | |
19829 | 19812 | Once you have a `Repository` instance, you can do all sorts of things with it. |
19830 | 19813 | Here's a quick sampling: |
19831 | 19814 |
@@ -19833,7 +19816,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi | ||
19833 | 19816 | ---- |
19834 | 19817 | // Get a reference |
19835 | 19818 | Ref master = repo.getRef("master"); |
19836 | -@@ -72,13 +91,13 @@ | |
19819 | +@@ -74,13 +91,13 @@ | |
19837 | 19820 | There's quite a bit going on here, so let's go through it one section at a time. |
19838 | 19821 | |
19839 | 19822 | 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 | ||
19849 | 19832 | |
19850 | 19833 | The next two lines show how to load the raw contents of an object. |
19851 | 19834 | 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 @@ | |
19858 | 19836 | 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. |
19859 | 19837 | JGit provides a higher-level set of APIs to help out with this, and the entry point to these APIs is the `Git` class: |
19860 | 19838 |
@@ -19862,7 +19840,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi | ||
19862 | 19840 | ---- |
19863 | 19841 | Repository repo; |
19864 | 19842 | // construct repo... |
19865 | -@@ -106,7 +128,21 @@ | |
19843 | +@@ -110,7 +128,21 @@ | |
19866 | 19844 | ---- |
19867 | 19845 | |
19868 | 19846 | 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 | ||
19885 | 19863 | |
19886 | 19864 | 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()`. |
19887 | 19865 | In this case, we're asking the `origin` remote for tags, but not heads. |
19888 | -@@ -119,7 +155,6 @@ | |
19866 | +@@ -123,7 +155,6 @@ | |
19889 | 19867 | This is only a small sampling of JGit's full capabilities. |
19890 | 19868 | If you're interested and want to learn more, here's where to look for information and inspiration: |
19891 | 19869 |
@@ -19895,7 +19873,7 @@ diff -au /tmp/book/B-embedding-git/sections/jgit.asc.tmp ../../git/progit2/progi | ||
19895 | 19873 | * The JGit Cookbook at https://github.com/centic9/jgit-cookbook[] has many examples of how to do specific tasks with JGit. |
19896 | 19874 | -* There are several good resources pointed out at http://stackoverflow.com/questions/6861881[]. |
19897 | 19875 | 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 | |
19899 | 19877 | +++ ../../git/progit2/progit2/book/B-embedding-git/sections/libgit2.asc 2020-07-01 10:48:37.625009675 +0900 |
19900 | 19878 | @@ -1,13 +1,15 @@ |
19901 | 19879 | === Libgit2 |
@@ -20059,12 +20037,10 @@ diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/pr | ||
20059 | 20037 | ==== Other Bindings |
20060 | 20038 | |
20061 | 20039 | 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 | |
20065 | 20043 | |
20066 | -+===== LibGit2Sharp | |
20067 | -+ | |
20068 | 20044 | +(((.NET)))(((C#)))(((Mono))) |
20069 | 20045 | If you're writing a .NET or Mono application, LibGit2Sharp (https://github.com/libgit2/libgit2sharp[]) is what you're looking for. |
20070 | 20046 | 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 | ||
20077 | 20053 | + |
20078 | 20054 | For desktop Windows applications, there's even a NuGet package that will help you get started quickly. |
20079 | 20055 | |
20080 | -+===== objective-git | |
20081 | -+ | |
20056 | + ===== objective-git | |
20057 | + | |
20082 | 20058 | +(((Apple)))(((Objective-C)))(((Cocoa))) |
20083 | 20059 | If your application is running on an Apple platform, you're likely using Objective-C as your implementation language. |
20084 | 20060 | 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 | ||
20093 | 20069 | + |
20094 | 20070 | Objective-git is fully interoperable with Swift, so don't fear if you've left Objective-C behind. |
20095 | 20071 | |
20072 | + ===== pygit2 | |
20073 | + | |
20096 | 20074 | -The bindings for Libgit2 in Python are called Pygit2, and can be found at http://www.pygit2.org/[]. |
20097 | -+===== pygit2 | |
20098 | -+ | |
20099 | 20075 | +(((Python))) |
20100 | 20076 | +The bindings for Libgit2 in Python are called Pygit2, and can be found at https://www.pygit2.org[]. |
20101 | 20077 | Our example program: |
@@ -20105,7 +20081,7 @@ diff -au /tmp/book/B-embedding-git/sections/libgit2.asc.tmp ../../git/progit2/pr | ||
20105 | 20081 | pygit2.Repository("/path/to/repo") # open repository |
20106 | 20082 | .head # get the current branch |
20107 | 20083 | 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 | |
20109 | 20085 | +++ ../../git/progit2/progit2/book/contributors.asc 2020-06-28 16:44:50.955019770 +0900 |
20110 | 20086 | @@ -1,4 +1,12 @@ |
20111 | 20087 | [preface] |
@@ -20122,7 +20098,7 @@ diff -au /tmp/book/contributors.asc.tmp ../../git/progit2/progit2/book/contribut | ||
20122 | 20098 | +---- |
20123 | 20099 | + |
20124 | 20100 | 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 | |
20126 | 20102 | +++ ../../git/progit2/progit2/book/dedication.asc 2020-06-28 16:44:50.960020506 +0900 |
20127 | 20103 | @@ -1,8 +1,8 @@ |
20128 | 20104 | -[preface] |
@@ -20137,12 +20113,12 @@ diff -au /tmp/book/dedication.asc.tmp ../../git/progit2/progit2/book/dedication. | ||
20137 | 20113 | +To my wife Jessica who has supported me for all of these years and to my daughter Josephine, |
20138 | 20114 | who will support me when I'm too old to know what's going on. — Scott_ |
20139 | 20115 | 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 | |
20141 | 20117 | +++ ../../git/progit2/progit2/book/index.asc 2020-06-28 16:44:50.960020506 +0900 |
20142 | 20118 | @@ -0,0 +1 @@ |
20143 | 20119 | +== Index |
20144 | 20120 | 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 | |
20146 | 20122 | +++ ../../git/progit2/progit2/book/introduction.asc 2020-06-28 16:44:50.960020506 +0900 |
20147 | 20123 | @@ -1,69 +1,58 @@ |
20148 | 20124 | [preface] |
@@ -20267,7 +20243,7 @@ diff -au /tmp/book/introduction.asc.tmp ../../git/progit2/progit2/book/introduct | ||
20267 | 20243 | -Let’s get started. |
20268 | 20244 | +Let's get started. |
20269 | 20245 | 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 | |
20271 | 20247 | +++ ../../git/progit2/progit2/book/license.asc 2020-06-28 16:44:50.961020654 +0900 |
20272 | 20248 | @@ -0,0 +1,4 @@ |
20273 | 20249 | +[preface] |
@@ -20275,7 +20251,7 @@ diff -au /tmp/book/license.asc.tmp ../../git/progit2/progit2/book/license.asc | ||
20275 | 20251 | + |
20276 | 20252 | +include::../LICENSE.asc[] |
20277 | 20253 | 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 | |
20279 | 20255 | +++ ../../git/progit2/progit2/book/preface_ben.asc 2020-06-28 16:44:50.961020654 +0900 |
20280 | 20256 | @@ -1,8 +1,12 @@ |
20281 | 20257 | [preface] |
@@ -20295,14 +20271,14 @@ diff -au /tmp/book/preface_ben.asc.tmp ../../git/progit2/progit2/book/preface_be | ||
20295 | 20271 | +I hope it helps you as much as it did me. |
20296 | 20272 | Warning: file not found: ../../git/progit2/progit2-ja/book/preface_schacon.asc |
20297 | 20273 | 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 | |
20299 | 20275 | +++ ../../git/progit2/progit2/book/toc.asc 2020-06-28 16:44:50.961020654 +0900 |
20300 | 20276 | @@ -0,0 +1 @@ |
20301 | 20277 | +{{ toc }} |
20302 | 20278 | Warning: file not found: ../../git/progit2/progit2-ja/ch01-getting-started.asc |
20303 | 20279 | Warning: file not found: ../../git/progit2/progit2-ja/ch02-git-basics-chapter.asc |
20304 | 20280 | 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 | |
20306 | 20282 | +++ ../../git/progit2/progit2/ch03-git-branching.asc 2020-06-28 16:44:50.963020948 +0900 |
20307 | 20283 | @@ -1,7 +1,7 @@ |
20308 | 20284 | -[#ch03-git-branching] |
@@ -20316,7 +20292,7 @@ diff -au /tmp/ch03-git-branching.asc.tmp ../../git/progit2/progit2/ch03-git-bran | ||
20316 | 20292 | 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. |
20317 | 20293 | Warning: file not found: ../../git/progit2/progit2-ja/ch04-git-on-the-server.asc |
20318 | 20294 | 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 | |
20320 | 20296 | +++ ../../git/progit2/progit2/ch05-distributed-git.asc 2020-06-28 16:44:50.963020948 +0900 |
20321 | 20297 | @@ -1,8 +1,8 @@ |
20322 | 20298 | -[#ch05-distributed-git] |
@@ -20331,7 +20307,7 @@ diff -au /tmp/ch05-distributed-git.asc.tmp ../../git/progit2/progit2/ch05-distri | ||
20331 | 20307 | In this chapter, you'll see how to work with Git in a distributed environment as a contributor and an integrator. |
20332 | 20308 | 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. |
20333 | 20309 | 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 | |
20335 | 20311 | +++ ../../git/progit2/progit2/ch06-github.asc 2020-06-28 16:44:50.963020948 +0900 |
20336 | 20312 | @@ -1,5 +1,4 @@ |
20337 | 20313 | -[#ch06-github] |
@@ -20340,7 +20316,7 @@ diff -au /tmp/ch06-github.asc.tmp ../../git/progit2/progit2/ch06-github.asc | ||
20340 | 20316 | == GitHub |
20341 | 20317 | |
20342 | 20318 | (((GitHub))) |
20343 | -@@ -12,6 +11,7 @@ | |
20319 | +@@ -12,14 +11,13 @@ | |
20344 | 20320 | |
20345 | 20321 | 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>>. |
20346 | 20322 |
@@ -20348,8 +20324,16 @@ diff -au /tmp/ch06-github.asc.tmp ../../git/progit2/progit2/ch06-github.asc | ||
20348 | 20324 | .Interfaces Change |
20349 | 20325 | ==== |
20350 | 20326 | 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[] | |
20351 | 20335 | 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 | |
20353 | 20337 | +++ ../../git/progit2/progit2/ch07-git-tools.asc 2020-06-28 16:44:50.963020948 +0900 |
20354 | 20338 | @@ -1,11 +1,10 @@ |
20355 | 20339 | -[#ch07-git-tools] |
@@ -20379,7 +20363,7 @@ diff -au /tmp/ch07-git-tools.asc.tmp ../../git/progit2/progit2/ch07-git-tools.as | ||
20379 | 20363 | +If you want to use subprojects in your project, you've learned how to accommodate those needs. |
20380 | 20364 | +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. |
20381 | 20365 | 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 | |
20383 | 20367 | +++ ../../git/progit2/progit2/ch08-customizing-git.asc 2020-06-28 16:44:50.964021095 +0900 |
20384 | 20368 | @@ -1,5 +1,4 @@ |
20385 | 20369 | -[#ch08-customizing-git] |
@@ -20390,7 +20374,7 @@ diff -au /tmp/ch08-customizing-git.asc.tmp ../../git/progit2/progit2/ch08-custom | ||
20390 | 20374 | 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. |
20391 | 20375 | Warning: file not found: ../../git/progit2/progit2-ja/ch09-git-and-other-systems.asc |
20392 | 20376 | 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 | |
20394 | 20378 | +++ ../../git/progit2/progit2/ch10-git-internals.asc 2020-06-28 16:44:50.964021095 +0900 |
20395 | 20379 | @@ -1,9 +1,8 @@ |
20396 | 20380 | -[#ch10-git-internals] |
@@ -20428,14 +20412,14 @@ diff -au /tmp/ch10-git-internals.asc.tmp ../../git/progit2/progit2/ch10-git-inte | ||
20428 | 20412 | Git as a content-addressable filesystem is a very powerful tool that you can easily use as more than just a VCS. |
20429 | 20413 | 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. |
20430 | 20414 | 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 | |
20432 | 20416 | +++ ../../git/progit2/progit2/index.asc 2020-06-28 16:44:51.438090759 +0900 |
20433 | 20417 | @@ -0,0 +1,3 @@ |
20434 | 20418 | +[#index] |
20435 | 20419 | +[index] |
20436 | 20420 | += Index |
20437 | 20421 | 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 | |
20439 | 20423 | +++ ../../git/progit2/progit2/progit.asc 2020-06-28 16:44:51.438090759 +0900 |
20440 | 20424 | @@ -0,0 +1,52 @@ |
20441 | 20425 | +Pro Git |
@@ -40,6 +40,7 @@ | ||
40 | 40 | ### Creative Commons Attribution-NonCommercial-ShareAlike 3.0 とします。 |
41 | 41 | |
42 | 42 | use strict; |
43 | +use Encode qw/decode_utf8 encode_utf8/; | |
43 | 44 | use File::Basename; |
44 | 45 | use File::Path; |
45 | 46 |
@@ -109,6 +110,12 @@ sub output_ja_tempfile { | ||
109 | 110 | if ($found_slashes_status == 2) { |
110 | 111 | if ($line =~ /^include/) { |
111 | 112 | $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 | + } | |
112 | 119 | } elsif ($line =~ /^\n/) { |
113 | 120 | if ($continue_flag == 0) { |
114 | 121 | $to_be_read = 0; $continue_flag = 0; |