Had this scerio in the sim recently. In the sim at least, if you reset the gravity extension handle and have G Hyd power available then the gear will retract.
The context was a scenario where the nose gear doens't down-lock (including after recycling) into a short runway where the length is insufficient to land after applying the landing with abnormal gear checklist. So in this case, the ECAM will ask for gravity gear extn. If you still fail to get 1 green triangle on each wheel then you can reset the handle, raise the gear and then divert clean.