rebase. As the keeper of
the canonical history, you need to view the history from the remote
as `ours` (i.e. "our shared canonical history"), while what you did
on your side branch as `theirs` (i.e. "one contributor's work on top
of it").
`-b <new-branch>`::
Create a new branch named _<new-branch>_, start it at
_<start-point>_, and check the resulting branch out;
see linkgit:git-branch[1] for details.
`-B <new-branch>`::
Creates the branch _<new-branch>_, start it at _<start-point>_;
if it already exists, then reset it to _<start-point>_. And then
check the resulting branch out. This is equivalent to running
`git branch` with `-f` followed by `git checkout` of that branch;
see linkgit:git-branch[1] for details.
`-t`::
`--track[=(direct|inherit)]`::
When creating a new branch, set up "upstream" configuration. See
`--track` in linkgit:git-branch[1] for details.
+
If no `-b` option is given, the name of the new branch will be
derived from the remote-tracking branch, by looking at the local part of
the refspec configured for the corresponding remote, and then stripping
the initial part up to the "*".
This would tell us to use `hack` as the local branch when branching
off of `origin/hack` (or `remotes/origin/hack`, or even
`refs/remotes/origin/hack`). If the given name has no slash, or the above
guessing results in an empty name, the guessing is aborted. You can
explicitly give a name with `-b` in such a case.
`--no-track`::
Do not set up "upstream" configuration, even if the
`branch.autoSetupMerge` configuration variable is true.
`--guess`::
`--no-guess`::
If _<branch>_ is not found but there does exist a tracking
branch in exactly one remote (call it _<remote>_) with a
matching name, treat as equivalent to
+
------------
$ git checkout -b <branch> --track <remote>/<branch>
------------
+
If the branch exists in multiple remotes and one of them is named by
the `checkout.defaultRemote` configuration variable, we'll use that
one for the purposes of disambiguation, even if the _<branch>_ isn't
unique across all remotes. Set it to
e.g. `checkout.defaultRemote=origin` to always checkout remote
branches from there if _<branch>_ is ambiguous but exists on the
'origin' remote. See also `checkout.defaultRemote` in
linkgit:git-config[1].
+
`--guess` is the default behavior. Use `--no-guess` to disable it.
+
The default behavior can be set via the `checkout.guess` configuration
variable.
`-l`::
Create the new branch's reflog; see linkgit:git-branch[1] for
details.
`-d`::
`--detach`::
Rather than checking out a branch to work on it, check out a
commit for inspection and discardable experiments.
This is the default behavior of `git checkout <commit>` when
_<commit>_ is not a branch name. See the "DETACHED HEAD" section
below for details.
`--orphan <new-branch>`::
Create a new unborn branch, named _<new-branch>_, started from
_<start-point>_ and switch to it. The first commit made on this
new branch will have no parents and it will be the root of a new
history totally disconnected from all the other branches and
commits.
+
The index and the working tree are adjusted as if you had previously run
`git checkout <start-point>`. This allows you to start a new history
that records a set of paths similar to _<start-point>_ by easily running
`git commit -a` to make the root commit.
+
This can be useful when you want to publish the tree from a commit
without exposing its full history. You might want to do this to publish
an open source branch of a project whose current tree is "clean", but
whose full history contains proprietary or otherwise encumbered bits of
code.
+
If you want to start a disconnected history that records a set of paths
that is totally different from the one of _<start-point>_, then you should
clear the index and the working tree right after creating the orphan
branch by running `git rm -rf .` from the top level of the working tree.
Afterwards you will be ready to prepare your new files, repopulating