User Tools

Site Tools


git_rebase

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
git_rebase [2019/03/06 15:45]
rpjday [DESCRIPTION]
git_rebase [2019/04/06 21:32]
rpjday [Simple example]
Line 6: Line 6:
  
 <​code>​ <​code>​
-git rebase [-i | --interactive] [<​options>​] [--exec <​cmd>​] [--onto <​newbase>​] +git rebase [-i | --interactive] [<​options>​] 
-        [<​upstream>​ [<​branch>​]] +  ​[--exec <​cmd>​] [--onto <​newbase>​] 
-git rebase [-i | --interactive] [<​options>​] [--exec <​cmd>​] [--onto <​newbase>​] +  [<​upstream>​ [<​branch>​]] 
-        --root [<​branch>​] +   
-git rebase --continue | --skip | --abort | --quit | --edit-todo | --show-current-patch+git rebase [-i | --interactive] [<​options>​] 
 +  ​[--exec <​cmd>​] [--onto <​newbase>​] 
 +  --root [<​branch>​] 
 +  - 
 +git rebase --continue | --skip | --abort | --quit | 
 +   --edit-todo | --show-current-patch
 </​code>​ </​code>​
  
-===== DESCRIPTION ​=====+===== The fundamental rebase operation ​===== 
 + 
 +Three components define a rebase: 
 + 
 +  * the //branch// to be rebased 
 +  * the amount of that branch to be rebased 
 +  * the target //commit// onto which to rebase 
 + 
 +===== Examples ===== 
 + 
 +==== Simple example ​====
  
 <​code>​ <​code>​
-If <​branch>​ is specified, git rebase will perform an automatic +              A---B---C ​          topic 
-git checkout <​branch>​ before doing anything else. Otherwise it +             / 
-remains on the current branch.+        ​D---E---F---G ​            ​master
 </​code>​ </​code>​
  
-In other words, the final optional argument ''​[branch]''​ can always be omitted if you first just:+One of:
  
 <​code>​ <​code>​
-$ git checkout <branch>+$ git checkout ​topic 
 +$ git rebase master 
 +</code> 
 + 
 +or: 
 + 
 +<​code>​ 
 +$ git rebase master topic 
 +</​code>​ 
 + 
 +<​code>​ 
 +                      A'​--B'​--C' ​ topic 
 +                     / 
 +        D---E---F---G ​            ​master 
 +</​code>​ 
 + 
 +==== Example requiring "​--onto newbase"​ ==== 
 + 
 +<​code>​ 
 +        o---o---o---o---o ​ master 
 +             \ 
 +              o---o---o---o---o ​ next 
 +                       \ 
 +                        o---o---o ​ topic 
 +</​code>​ 
 + 
 +<​code>​ 
 +$ git rebase --onto master next topic 
 +</​code>​ 
 + 
 +<​code>​ 
 +                          o---o---o ​ topic 
 +                         / 
 +        o---o---o---o---o ​ master 
 +             \ 
 +              o---o---o---o---o ​ next
 </​code>​ </​code>​
  
-then just pretend it says ''​HEAD''​. 
  
-===== Examples ===== 
  
 ==== Removing a sequence of commits ===== ==== Removing a sequence of commits =====
git_rebase.txt · Last modified: 2019/04/06 21:34 by rpjday