Information Technology Reference
In-Depth Information
rections again and again. As a result the remote branch
new-web-interface
con-
tains a large number of commits. You are in charge of the
new-web-interface
re-
mote branch. The leader asked you to squash all the commits in this branch into a
single commit before he can finally merge it.
In this recipe we are using the scenario from Recipe 10-7. You act as a developer
working in
johns-repo
.
Solution
Copy the all the repositories from Recipe 10-7:
$ cd git-recipes
$ cp -R 10-07 10-10
$ cd 10-10
Now you are a developer working in
new-web-interface
in
10-10/johns-
repo
:
Your local
new-web-interface
branch contains three revisions
a
,
b
, and
c
.
You want to squash them and update the remote branch.
Here is the procedure that you have to follow (all the commands are to be executed
in
10-10/johns-repo
):
1. Go to the
new-web-interface
branch:
$ git checkout new-
web-interface
2. Your
new-web-interface
branch contains three revisions
a
,
b
, and
c
. You can check it with
$ git log --oneline
.
3. The revisions
a
,
b
,
c
are not merged into the
master
branch yet. You
can check it with:
$ git log --oneline master..new-web-
interface
4. Squash your three commits with:
$ git rebase -i HEAD
∼
3
. Use
the following interactive rebasing subcommands:
reword XXXXXXX a
fixup XXXXXXX b
fixup XXXXXXX c