Documentation / git-rebase.txton commit git-fetch: do not look into $GIT_DIR/refs to see if a tag exists. (47292d6)
   1git-rebase(1)
   2=============
   3
   4NAME
   5----
   6git-rebase - Rebase local commits to a new head
   7
   8SYNOPSIS
   9--------
  10'git-rebase' [--merge] [--onto <newbase>] <upstream> [<branch>]
  11
  12'git-rebase' --continue | --skip | --abort
  13
  14DESCRIPTION
  15-----------
  16git-rebase replaces <branch> with a new branch of the same name.  When
  17the --onto option is provided the new branch starts out with a HEAD equal
  18to <newbase>, otherwise it is equal to <upstream>.  It then attempts to
  19create a new commit for each commit from the original <branch> that does
  20not exist in the <upstream> branch.
  21
  22It is possible that a merge failure will prevent this process from being
  23completely automatic.  You will have to resolve any such merge failure
  24and run `git rebase --continue`.  Another option is to bypass the commit
  25that caused the merge failure with `git rebase --skip`.  To restore the
  26original <branch> and remove the .dotest working files, use the command
  27`git rebase --abort` instead.
  28
  29Note that if <branch> is not specified on the command line, the currently
  30checked out branch is used.
  31
  32Assume the following history exists and the current branch is "topic":
  33
  34------------
  35          A---B---C topic
  36         /
  37    D---E---F---G master
  38------------
  39
  40From this point, the result of either of the following commands:
  41
  42
  43    git-rebase master
  44    git-rebase master topic
  45
  46would be:
  47
  48------------
  49                  A'--B'--C' topic
  50                 /
  51    D---E---F---G master
  52------------
  53
  54While, starting from the same point, the result of either of the following
  55commands:
  56
  57    git-rebase --onto master~1 master
  58    git-rebase --onto master~1 master topic
  59
  60would be:
  61
  62------------
  63              A'--B'--C' topic
  64             /
  65    D---E---F---G master
  66------------
  67
  68In case of conflict, git-rebase will stop at the first problematic commit
  69and leave conflict markers in the tree.  You can use git diff to locate
  70the markers (<<<<<<) and make edits to resolve the conflict.  For each
  71file you edit, you need to tell git that the conflict has been resolved,
  72typically this would be done with
  73
  74
  75    git update-index <filename>
  76
  77
  78After resolving the conflict manually and updating the index with the
  79desired resolution, you can continue the rebasing process with
  80
  81
  82    git rebase --continue
  83
  84
  85Alternatively, you can undo the git-rebase with
  86
  87
  88    git rebase --abort
  89
  90OPTIONS
  91-------
  92<newbase>::
  93        Starting point at which to create the new commits. If the
  94        --onto option is not specified, the starting point is
  95        <upstream>.
  96
  97<upstream>::
  98        Upstream branch to compare against.
  99
 100<branch>::
 101        Working branch; defaults to HEAD.
 102
 103--continue::
 104        Restart the rebasing process after having resolved a merge conflict.
 105
 106--abort::
 107        Restore the original branch and abort the rebase operation.
 108
 109--skip::
 110        Restart the rebasing process by skipping the current patch.
 111
 112--merge::
 113        Use merging strategies to rebase.  When the recursive (default) merge
 114        strategy is used, this allows rebase to be aware of renames on the
 115        upstream side.
 116
 117-s <strategy>, \--strategy=<strategy>::
 118        Use the given merge strategy; can be supplied more than
 119        once to specify them in the order they should be tried.
 120        If there is no `-s` option, a built-in list of strategies
 121        is used instead (`git-merge-recursive` when merging a single
 122        head, `git-merge-octopus` otherwise).  This implies --merge.
 123
 124include::merge-strategies.txt[]
 125
 126NOTES
 127-----
 128When you rebase a branch, you are changing its history in a way that
 129will cause problems for anyone who already has a copy of the branch
 130in their repository and tries to pull updates from you.  You should
 131understand the implications of using 'git rebase' on a repository that
 132you share.
 133
 134When the git rebase command is run, it will first execute a "pre-rebase"
 135hook if one exists.  You can use this hook to do sanity checks and
 136reject the rebase if it isn't appropriate.  Please see the template
 137pre-rebase hook script for an example.
 138
 139You must be in the top directory of your project to start (or continue)
 140a rebase.  Upon completion, <branch> will be the current branch.
 141
 142Author
 143------
 144Written by Junio C Hamano <junkio@cox.net>
 145
 146Documentation
 147--------------
 148Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
 149
 150GIT
 151---
 152Part of the gitlink:git[7] suite
 153