If $G/Z(G)\cong \Bbb{Z}_2\times \Bbb{Z}_2$, then $G'\cong \Bbb{Z}_2$ 
If $G/Z(G)\cong \Bbb{Z}_2\times \Bbb{Z}_2$, then $G'\cong \Bbb{Z}_2$.

Clearly $G$ is non-abelian, hence $G'\neq 1$.
Since $G/Z(G)$ is abelian, $G' \leq Z(G)$.
Next, since $G$ is nilpotent of class $2$, $\exp(G')=\exp(G/Z(G))=2$.
So far I can only deduce these information yet I still can't get the conclusion.
 A: There is another interesting way for this. 

Theorem: If $G$ is a non-abelian $p$-group with an abelian subgroup of index $p$ then $|G|=p.|Z(G)|.|G'|$.

In your problem, $[G:Z(G)]=4$, so considering an $a\in G\setminus Z(G)$, we get $\langle a,Z(G)\rangle$ an abelian subgroup of index $2$. Now apply theorem to conclude that $|G'|=2$.
A: Theorem Let $A \unlhd G$ be abelian, and $G/A$ cyclic. Then $$G' \cong A/(A \cap Z(G)).$$
For a proof see for example I.M. Isaacs, Finite Group Theory, Lemma (4.6). Let us apply that to your case: $G/Z(G) \cong C_2 \times C_2$, hence we can choose (the pre-image of one of the three non-trivial elements of the quotient) a subgroup $Z(G) \subset A \subset G$. Then $|G:A|=2$, so $A$ is normal and $G/A$ is cyclic. Further, $Z(G) \subseteq Z(A) \subseteq A$. Hence $A/Z(A)$ is cyclic and so $A$ must be abelian. Now apply the theorem. 
This Theorem (not hard to prove) implies by the way the result mentioned below by Beginner.
In a similar vein you can prove: of $G/Z(G) \cong S_3$, then $G' \cong C_3$, or even more general: if $p$ is a prime, $G/Z(G) \cong D_p$, the dihedral group of order $2p$, then $G' \cong C_p (\cong D_p')$.
A: We have $G=\langle a,b,Z\rangle$, for some $a,b\in G$. Now, using what you already know, it shouldn't be hard to show that the commutator subgroup is generated by $[a,b]$.
