Information Technology Reference
In-Depth Information
Clone the repository from Recipe 6-4 with branches:
$ cd git-recipes
$ git clone-with-branches 06-04 07-02
$ cd 07-02
and then follow these steps:
1. Checkout the
feature
branch with
$ git checkout feature
2. Generate patches for revisions
f1
,
f2
, and
f3
with:
$ git format-patch --ignore-if-in-upstream master
3. Enter the detached HEAD state with
HEAD
pointing to the same revision
as the
master
branch. You will achieve this executing:
$ git
checkout `git rev-parse master`
4. Apply patches with
$ git am *.patch
5. Move the
feature
branch to your current revision using
$ git
checkout -B feature
6. Remove the patches with
$ rm *.patch
How It Works
The
feature
branch contains three commits
f1
,
f2
, and
f3
that are not included in
the
master
branch. You can check it with:
$ git log --oneline master..feature
The output will present three commits:
0deae94 f3
c1cab03 f2
3df8f34 f1