This will squash second commit into the first one:
A-B-C-... -> AB-C-...
git filter-branch --commit-filter '
if [ "$GIT_COMMIT" = <sha1ofA> ];
then
skip_commit "$@";
else
git commit-tree "$@";
fi
' HEAD
Commit message for AB will be taken from B (although I'd prefer from A).
Has the same effect as Uwe Kleine-König's answer, but works for non-initial A as well.