@matheusbsbs / matheus-bagliano / commits / ff9054627c
Fork 0

git-rebase: document suppression of duplicate commits

git-rebase uses format-patch's --ignore-if-in-upstream option, but we never document the user-visible behavior. The example is placed near the top of the example list rather than at the bottom because it is: a. a simple example b. a reasonably common scenario for many projects (mail some patches which get accepted upstream, then rebase) [sp: Corrected direction of 'HEAD..<upstream>' set comparsion] Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Jeff King committed Oct 15, 2007 at 00:47 UTC ff9054627c40082ad4a1cf16afebb140fcda41a2
1 file changed +24 -1
Documentation/git-rebase.txt
+24 -1
@@ -28,7 +28,10 @@ The current branch is reset to <upstream>, or <newbase> if the
28 `git reset --hard <upstream>` (or <newbase>).
29
30 The commits that were previously saved into the temporary area are
31 -then reapplied to the current branch, one by one, in order.
31 +then reapplied to the current branch, one by one, in order. Note that
32 +any commits in HEAD which introduce the same textual changes as a commit
33 +in HEAD..<upstream> are omitted (i.e., a patch already accepted upstream
34 +with a different commit message or timestamp will be skipped).
35
36 It is possible that a merge failure will prevent this process from being
37 completely automatic. You will have to resolve any such merge failure
@@ -62,6 +65,26 @@ would be:
65 The latter form is just a short-hand of `git checkout topic`
66 followed by `git rebase master`.
67
68 +If the upstream branch already contains a change you have made (e.g.,
69 +because you mailed a patch which was applied upstream), then that commit
70 +will be skipped. For example, running `git-rebase master` on the
71 +following history (in which A' and A introduce the same set of changes,
72 +but have different committer information):
73 +
74 +------------
75 + A---B---C topic
76 + /
77 + D---E---A'---F master
78 +------------
79 +
80 +will result in:
81 +
82 +------------
83 + B'---C' topic
84 + /
85 + D---E---A'---F master
86 +------------
87 +
88 Here is how you would transplant a topic branch based on one
89 branch to another, to pretend that you forked the topic branch
90 from the latter branch, using `rebase --onto`.