Information Technology Reference
In-Depth Information
branch to the
feature
branch. This is exactly the purpose of the second command
$
git rebase feature master
.
Fast-forwarding can be done with either
$ git merge
or
$ git rebase
. Here
are the commands to fast-forward the
master
branch with the
$ git merge
com-
mand:
$ git checkout master
$ git merge feature
and this is the command to do the same with the
$ git rebase
command:
$ git rebase feature master
Fast-forwarding with
$ git merge
was discussed in Recipe 6-2.
7-4. Diverging three branches
Problem
Your repository contains two divergent branches
master
and
feature
, as shown in
Figure 7-8(a)
.
First you want to work on some new idea, basing your work on the latest
revision in your
feature
branch. You need to create a new branch called
brave-
idea
and to commit your changes as revisions
b1
and
b2
. Next you want to switch to
the
feature
branch and create three new revisions
f4
,
f5
, and
f6
. The repository
you want to achieve is shown in
Figure 7-8(b)
.