The writ of habeas corpus may be granted in the manner provided by law. If the writ has been granted by any court or a judge thereof and after the hearing thereof the prisoner has been remanded, he or she shall not be discharged from custody by the same or any other court of like general jurisdiction, or by a judge of the same or any other court of like general jurisdiction, unless upon some ground not existing in fact at the issuing of the prior writ. Should the prisoner desire to urge some point of law not raised in the petition for or at the hearing upon the return of the prior writ, then, in case the prior writ had been returned or returnable before a superior court or a judge thereof, no writ can be issued upon a second or other application except by the appropriate court of appeal or some judge thereof, or by the Supreme Court or some judge thereof, and in the event the writ must not be made returnable before any superior court or any judge thereof. In the event, however, that the prior writ was returned or made returnable before a court of appeal or any judge thereof, no writ can be issued upon a second or other application except by the Supreme Court or some judge thereof, and the writ must be made returnable before said Supreme Court or some judge thereof.
Every application for a writ of habeas corpus must be verified, and shall state whether any prior application or applications have been made for a writ in regard to the same detention or restraint complained of in the application, and if any prior application or applications have been made the later application must contain a brief statement of all proceedings had therein, or in any of them, to and including the final order or orders made therein, or in any of them, on appeal or otherwise.
Whenever the person applying for a writ of habeas corpus is held in custody or restraint by any officer of any court of this state or any political subdivision thereof, or by any peace officer of this state, or any political subdivision thereof, a copy of the application for the writ must in all cases be served upon the district attorney of the county wherein the person is held in custody or restraint at least 24 hours before the time at which said writ is made returnable and no application for the writ can be heard without proof of service in cases where the service is required.
If the person is in custody for violation of an ordinance of a city which has a city attorney, a copy of the application for the writ must also be served on the city attorney of the city whose ordinance is the basis for the charge at least 24 hours before the time at which the writ is made returnable, provided that failure to serve the city attorney shall not deprive the court of jurisdiction to hear the application. If a writ challenging a denial of parole or the applicant's suitability for parole is then made returnable, a copy of the application for the writ and the related order to show cause shall in all cases be served by the superior court upon the office of the Attorney General and the district attorney of the county in which the underlying judgment was rendered at least three business days before the time at which the writ is made returnable and no application for the writ can be heard without proof of such service.
Ca. Pen. Code § 1475