If there is nothing of use in Z you can get rid of it with reset --hard
git reset --hard init (if init is a branch)
or
git reset --hard HEAD^ (moves one commit back)
If you need to keep Z but as early as possible (first possible is after A) then you can do an interactiv rebase
git rebase -i <sha of A>
and reorder de commits as
Z
B
C
(A is not show as it's the root commit)