The court to which the committing magistrate returns the depositions, or in which an indictment, information, or appeal is pending, or to which a judgment on appeal is remitted to be carried into effect, may, by an order entered upon its minutes, direct the arrest of the defendant and his or her commitment to the officer to whose custody he or she was committed at the time of giving bail, and his or her detention until legally discharged, in the following cases: