Information Technology Reference
In-Depth Information
picks the commit
b
. Thus it will appear in the resulting history. You can think of a
pick command as a cherry-pick. The patch defined by the revision
f2136a0
is ap-
plied. The next command:
fixup a36ee90 c
squashes the commit
c
into the previous commit
b
. The fixup command doesn't al-
low you to modify the comment for the resulting commit. You will get the commit that
incorporates the change sets from commits
b
and
c
and is denoted with the original
comment of commit
b
.
The last command:
fixup 46c002f d
performs one more squashing. This time git squashes commit
d
into the result of the
squashing of
c
into
b
. Thus you will end up with a single commit denoted with com-
ment
b
and incorporating the change sets from commits
b
,
c
, and
d
.
All the operations performed by t he interactive rebasing are stored in the reflog.
Now, the command
$ git reflog
prints the following results:
e3fc0e0 HEAD@{0}: rebase -i (finish): returning to refs/
heads/master
e3fc0e0 HEAD@{1}: rebase -i (squash): b
5eb1d5a HEAD@{2}: rebase -i (squash): # This is a
combination of 2 commits.
f2136a0 HEAD@{3}: checkout: moving from master to f2136a0
46c002f HEAD@{4}: commit: d
a36ee90 HEAD@{5}: commit: c
f2136a0 HEAD@{6}: commit: b
d344a8a HEAD@{7}: commit (initial): a
As you may guess the original revisions remain in the database until they are
purged. In case you wanted to undo the rebasing here is the command you would
need:
$ git reset --hard HEAD@{4}
.
The list of files modified in a given revision is printed by the
$ git show --
name-only [REVISION]
command. You can also use
$ git log --name-
only REVISION
∼
..REVISION
or
$ git diff --name-only
REVISION
∼
..REVISION
to achieve similar results. The range