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: en/book/05-distributed-git/chapter5.asc
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,8 +193,8 @@ John has a reference to the changes Jessica pushed up, but he has to merge them
193
193
The merge goes smoothly — John’s commit history now looks like <<contrib_b>>.
194
194
195
195
[[contrib_b]]
196
-
.John’s repository after merging origin/master.
197
-
image::images/18333fig0505-tn.png[John’s repository after merging origin/master.]
196
+
.John’s repository after merging `origin/master`.
197
+
image::images/18333fig0505-tn.png[John’s repository after merging `origin/master`.]
198
198
199
199
Now, John can test his code to make sure it still works properly, and then he can push his new merged work up to the server:
200
200
@@ -208,8 +208,8 @@ Now, John can test his code to make sure it still works properly, and then he ca
208
208
Finally, John’s commit history looks like <<contrib_c>>.
209
209
210
210
[[contrib_c]]
211
-
.John’s history after pushing to the origin server.
212
-
image::images/18333fig0506-tn.png[John’s history after pushing to the origin server.]
211
+
.John’s history after pushing to the `origin` server.
212
+
image::images/18333fig0506-tn.png[John’s history after pushing to the `origin` server.]
213
213
214
214
In the meantime, Jessica has been working on a topic branch. She’s created a topic branch called `issue54` and done three commits on that branch. She hasn’t fetched John’s changes yet, so her commit history looks like <<contrib_d>>.
215
215
@@ -515,8 +515,8 @@ On a project for which you’re not the maintainer, it’s generally easier to h
515
515
Now, each of your topics is contained within a silo — similar to a patch queue — that you can rewrite, rebase, and modify without the topics interfering or interdepending on each other as in <<psp_a>>.
516
516
517
517
[[psp_a]]
518
-
.Initial commit history with featureB work.
519
-
image::images/18333fig0516-tn.png[Initial commit history with featureB work.]
518
+
.Initial commit history with `featureB` work.
519
+
image::images/18333fig0516-tn.png[Initial commit history with `featureB` work.]
520
520
521
521
Let’s say the project maintainer has pulled in a bunch of other patches and tried your first branch, but it no longer cleanly merges. In this case, you can try to rebase that branch on top of `origin/master`, resolve the conflicts for the maintainer, and then resubmit your changes:
522
522
@@ -529,8 +529,8 @@ Let’s say the project maintainer has pulled in a bunch of other patches and tr
529
529
This rewrites your history to now look like <<psp_b>>.
530
530
531
531
[[psp_b]]
532
-
.Commit history after featureA work.
533
-
image::images/18333fig0517-tn.png[Commit history after featureA work.]
532
+
.Commit history after `featureA` work.
533
+
image::images/18333fig0517-tn.png[Commit history after `featureA` work.]
534
534
535
535
Because you rebased the branch, you have to specify the `-f` to your push command in order to be able to replace the `featureA` branch on the server with a commit that isn’t a descendant of it. An alternative would be to push this new work to a different branch on the server (perhaps called `featureAv2`).
536
536
@@ -549,8 +549,8 @@ The `--squash` option takes all the work on the merged branch and squashes it in
549
549
Now you can send the maintainer a message that you’ve made the requested changes and they can find those changes in your `featureBv2` branch (see <<psp_c>>).
550
550
551
551
[[psp_c]]
552
-
.Commit history after featureBv2 work.
553
-
image::images/18333fig0518-tn.png[Commit history after featureBv2 work.]
552
+
.Commit history after `featureBv2` work.
553
+
image::images/18333fig0518-tn.png[Commit history after `featureBv2` work.]
554
554
555
555
==== Public Large Project
556
556
@@ -933,8 +933,8 @@ Other maintainers prefer to rebase or cherry-pick contributed work on top of the
933
933
The other way to move introduced work from one branch to another is to cherry-pick it. A cherry-pick in Git is like a rebase for a single commit. It takes the patch that was introduced in a commit and tries to reapply it on the branch you’re currently on. This is useful if you have a number of commits on a topic branch and you want to integrate only one of them, or if you only have one commit on a topic branch and you’d prefer to cherry-pick it rather than run rebase. For example, suppose you have a project that looks like <<merwf_h>>.
934
934
935
935
[[merwf_h]]
936
-
.Example history before a cherrypick.
937
-
image::images/18333fig0526-tn.png[Example history before a cherrypick.]
936
+
.Example history before a cherry-pick.
937
+
image::images/18333fig0526-tn.png[Example history before a cherry-pick.]
938
938
939
939
If you want to pull commit `e43a6` into your master branch, you can run
0 commit comments