Information Technology Reference
In-Depth Information
$ cd 08-05
$ git simple-commit a b c d
The command
$ git log --oneline
now returns the following output:
cc595c7
d
7bb0fe3
c
b040c68
b
9dfe77d
a
The revisions are ordered
a
,
b
,
c
,
d
. The oldest is
a
, and
d
is the newest.
Now perform interactive rebasing with
$ git rebase -i HEAD
∼
3
. After this
command git will start vim with the contents shown in
Listing 8-5
. Replace the con-
tents shown in
Listing 8-5
with the code presented in
Listing 8-6
.
The change is very
slight: the commits are reordered. Then save the file and close the editor.
are ordered b, c, d)
pick b040c68
b
pick 7bb0fe3
c
pick cc595c7
d
Listing 8-6.
The contents you should type in the editor during interactive rebasing (the
commits are ordered d, b, c)
p
cc595c7
d
p
b040c68
b
p
7bb0fe3
c
When you save and close the editor git will perform rebasing. After this operation is
finished check the order of your revisions with the
$ git log
command. The output
of
$ git log -oneline
should be the following:
7bb0fe3
c
b040c68
b
cc595c7
d
9dfe77d
a