In Germany, if the mother is unmarried, she has sole custody.
If you are not married, but you and your partner would like to share custody, you can submit a declaration of custody to the youth welfare office or a notary before the birth. However, the declaration of custody only becomes effective when the father acknowledges paternity. This document should be in the hospital bag as it is required for registering the birth.
Acknowledgment of paternity
If you are not married to the father of your child, you must have paternity recognized when your child is born. An acknowledgment of paternity can be made at any time at the registry office, the youth welfare office or a notary and must be publicly certified in any case. This means that paternity must be declared in the presence of a person authorized to certify (e.g. the notary or a specialist employed by the registry office or youth welfare office). The acknowledgment of paternity also belongs in the hospital bag. It is also required to register the birth.