You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: book/05-distributed-git/sections/maintaining.asc
+19-12Lines changed: 19 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@ There are two ways to apply an emailed patch: with `git apply` or with `git am`.
38
38
===== Applying a Patch with apply
39
39
40
40
(((git commands, apply)))
41
-
If you received the patch from someone who generated it with the `git diff` or a Unix `diff` command (which is not recommended; see the next section), you can apply it with the `git apply` command.
41
+
If you received the patch from someone who generated it with `git diff` or some variation of the Unix `diff` command (which is not recommended; see the next section), you can apply it with the `git apply` command.
42
42
Assuming you saved the patch at `/tmp/patch-ruby-client.patch`, you can apply the patch like this:
43
43
44
44
[source,console]
@@ -87,12 +87,11 @@ Subject: [PATCH 1/2] add limit to log function
87
87
Limit log functionality to the first 20
88
88
----
89
89
90
-
This is the beginning of the output of the `format-patch` command that you saw in the previous section.
91
-
This is also a valid mbox email format.
90
+
This is the beginning of the output of the `git format-patch` command that you saw in the previous section; it also represents a valid mbox email format.
92
91
If someone has emailed you the patch properly using `git send-email`, and you download that into an mbox format, then you can point `git am` to that mbox file, and it will start applying all the patches it sees.
93
92
If you run a mail client that can save several emails out in mbox format, you can save entire patch series into a file and then use `git am` to apply them one at a time.
94
93
95
-
However, if someone uploaded a patch file generated via `format-patch` to a ticketing system or something similar, you can save the file locally and then pass that file saved on your disk to `git am` to apply it:
94
+
However, if someone uploaded a patch file generated via `git format-patch` to a ticketing system or something similar, you can save the file locally and then pass that file saved on your disk to `git am` to apply it:
96
95
97
96
[source,console]
98
97
----
@@ -264,7 +263,7 @@ For example, if you've added a line in a file on the `master` branch, a direct c
264
263
265
264
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.
266
265
267
-
What you really want to see are the changes added to the topic branch – the work you'll introduce if you merge this branch with master.
266
+
What you really want to see are the changes added to the topic branch -- the work you'll introduce if you merge this branch with master.
268
267
You do that by having Git compare the last commit on your topic branch with the first common ancestor it has with the master branch.
269
268
270
269
Technically, you can do that by explicitly figuring out the common ancestor and then running your diff on it:
However, that isn't convenient, so Git provides another shorthand for doing the same thing: the triple-dot syntax.
280
-
In the context of the `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:
278
+
or, more concisely:
279
+
280
+
[source,console]
281
+
----
282
+
$ git diff $(git merge-base contrib master)
283
+
----
284
+
285
+
However, neither of those is particularly convenient, so Git provides another shorthand for doing the same thing: the triple-dot syntax.
286
+
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:
281
287
282
288
[source,console]
283
289
----
@@ -297,10 +303,11 @@ You have a number of choices, so we'll cover a few of them.
297
303
===== Merging Workflows
298
304
299
305
(((workflows, merging)))
300
-
One simple workflow is to merge the work into your `master` branch.
306
+
One basic workflow is to simply merge all that work directly into your `master` branch.
301
307
In this scenario, you have a `master` branch that contains basically stable code.
302
-
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.
303
-
If we have a repository with work in two branches named `ruby_client` and `php_client` that looks like <<merwf_a>> and merge `ruby_client` first and then `php_client` next, then your history will end up looking like <<merwf_b>>.
308
+
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.
309
+
310
+
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>>.
304
311
305
312
[[merwf_a]]
306
313
.History with several topic branches.
@@ -329,7 +336,7 @@ image::images/merging-workflows-4.png[After a topic branch merge.]
329
336
.After a project release.
330
337
image::images/merging-workflows-5.png[After a topic branch release.]
331
338
332
-
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.
339
+
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 content.
333
340
You can also extend this concept by having an `integrate` branch where all the work is merged together.
334
341
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.
335
342
@@ -421,7 +428,7 @@ We will cover rerere in more detail in <<_rerere>>.
421
428
==== Tagging Your Releases
422
429
423
430
(((tags)))(((tags, signing)))
424
-
When you've decided to cut a release, you'll probably want to drop a tag so you can re-create that release at any point going forward.
431
+
When you've decided to cut a release, you'll probably want to assign a tag so you can re-create that release at any point going forward.
425
432
You can create a new tag as discussed in <<_git_basics_chapter>>.
426
433
If you decide to sign the tag as the maintainer, the tagging may look something like this:
0 commit comments