Information Technology Reference
In-Depth Information
Figure 8-7
.
Editing older revisions
Solution
Create a new repository containing revisions
a
,
b
,
x
,
c
,
d
:
$ cd git-recipes
$ git init 08-07
$ cd 08-07
$ git simple-commit a b x c d
and perform interactive rebasing with
$ git rebase -i HEAD
∼
3
. The origin-
al subcommands of interactive rebasing are shown in
Listing 8-9
.
Replace them with
the subcommands shown in
Listing 8-10
.
You are to change the command concerning
the revision
x
from
pick
into
edit
. Then save the file and close the editor.
Listing 8-9.
The original subcommands of interactive rebasing in Recipe 8-7
pick 9aa7b18 x
pick 2455e82 c
pick f8bf7b5 d
Listing 8-10.
The commands that perform the transformation shown in
Figure 8-7
edit 9aa7b18 x
pick 2455e82 c
pick f8bf7b5 d
The rebasing process stops at the commit
x
. You can now adjust the
x
commit with
following commands:
$ echo y > y.txt
$ git add y.txt
$ git commit --amend --no-edit
When the
x
commit is adjusted, create a new revision
z
with
$ git simple-
commit z
. Finally, finish the rebasing with
$ git rebase --continue
.