Information Technology Reference
In-Depth Information
The switch
-i
of the rebase command turns on the interactive mode. The command
will start the vim editor with the contents shown in
Listing 8-3
.
Change the contents of
the editor—type the commands shown in
Listing 8-4
. You should change the words
pick
that appear before second and third commit into
fixup
.
pick f2136a0 b
pick a36ee90 c
pick 46c002f d
# Rebase d344a8a..46c002f onto d344a8a
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's
log message
# x, exec = run command (the rest of the line) using
shell
Listing 8-4.
The contents of vim that you have to type right after $ git rebase -i
HEAD
∼
3
pick f2136a0 b
fixup a36ee90 c
fixup 46c002f d
After you have typed the contents of the
Listing 8-4
, close the editor. Then git will
perform the operation. After this check the history of the repository with:
$ git log --oneline
This command will print only two commits
a
and
b
. According to the
$ ls
com-
mand the working directory still contains four files. The command: