git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH/RFC] Documentation: Two more git-rebase --onto examples

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 4, 2006, 21:05 UTC
Message-ID
<200611042205.58212.jnareb@gmail.com>

Added example of transplantig feature branch from one development branch (for example "next") into the other development branch (for example "master").

Added example of rebasing part of branch, or transplanting feature branch from the tip of other feature branch to the development branch the second feature branch started from.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
I asked for comments because I'm not native English speaker and I'm not
sure about correctness of descriptions of added examples.

P.S. Perhaps we should separate the part dealing with CONFLICT(contents) into separate documentation file, and include it as needed (for example alsop in git-push(1)).

 Documentation/git-rebase.txt |   55 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 10f2924..1308d2f 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -65,6 +65,61 @@ would be:
     D---E---F---G master
 ------------
 
+More useful example of --onto option usage include transplanting feature
+branch from one development branch to other, for example change to branch
+based off "next" branch:
+
+------------
+    o---o---o---o---o  master
+         \
+          o---o---o---o---o  next
+                           \
+                            o---o---o  topic
+------------
+
+to being a branch based off "master" branch as shown below:
+
+------------
+    o---o---o---o---o  master
+        |            \
+        |             o'--o'--o'  topic
+         \
+          o---o---o---o---o  next
+------------
+
+We can get this using the following command:
+
+    git-rebase --onto master next topic
+
+
+Yet another example of use for --onto option is to rebase part of
+branch. If we have the following situation:
+
+------------
+                            H---I---J topicB
+                           /
+                  E---F---G  topicA
+                 /
+    A---B---C---D  master
+------------
+
+then the command
+
+    git-rebase --onto master topicA topicB
+
+would give us the following situation:
+
+------------
+                 H'--I'--J'  topicB
+                /
+                | E---F---G  topicA
+                |/
+    A---B---C---D  master
+------------
+
+with "topicB" branch based off "master".
+
+
 In case of conflict, git-rebase will stop at the first problematic commit
 and leave conflict markers in the tree.  You can use git diff to locate
 the markers (<<<<<<) and make edits to resolve the conflict.  For each
-- 
1.4.3.3
Next: Junio C Hamano
Message 1 of 8 in “Documentation: Two more git-rebase --onto examples”
  1. Documentation: Two more git-rebase --onto examplesJakub Narebski, Nov 4, 2006
  2. Junio C HamanoNov 5, 2006
  3. Jakub NarebskiNov 5, 2006
  4. Documentation: Transplanting branch with git-rebase --ontoJakub Narebski, Nov 6, 2006
  5. Junio C HamanoNov 6, 2006
  6. Jakub NarebskiNov 6, 2006
  7. Carl WorthNov 6, 2006
  8. Junio C HamanoNov 6, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.