Information Technology Reference
In-Depth Information
Figure 8-3
.
Squashing the last three revisions
Solution
Create a new repository containing revisions
a
,
b
,
c
, and
d
:
$ cd git-recipes
$ git init 08-03
$ cd 08-03
$ git simple-commit a b c d
Your repository now contains four revisions and the working directory contains four
files. You can check it with the
$ git log
and
$ ls
command, of course. If you
want to verify which files are included in last revision use the following command:
$ git show --name-only HEAD
It will print the information that the last revision has the comment
d
, which includes
one file named
d.txt
. In similar way you can list the files included in any previous
revisions:
$ git show --name-only HEAD
∼
$ git show --name-only HEAD
∼
2
Let's squash the last three commits into a single revision. To do this run the follow-
ing command:
$ git rebase -i HEAD
∼
3