Related Rule
Germany
Practice Relating to Rule 20. Advance Warning
Germany’s Military Manual (1992) states: “Before engaging an objective, every responsible military leader shall give the civilian population advance warning of attacks which may affect it, unless circumstances do not permit.” 
Germany, Humanitarian Law in Armed Conflicts – Manual, DSK VV207320067, edited by The Federal Ministry of Defence of the Federal Republic of Germany, VR II 3, August 1992, English translation of ZDv 15/2, Humanitäres Völkerrecht in bewaffneten KonfliktenHandbuch, August 1992, § 457; see also §§ 414, 447 and 453.
Germany’s Soldiers’ Manual (2006) states:
When attacking a military objective, all necessary precautions shall be taken to spare as far as possible the civilian population located in the area or in the immediate vicinity of the object. If possible, the civilian population shall be warned of an attack. 
Germany, Druckschrift Einsatz Nr. 03, Humanitäres Völkerrecht in bewaffneten Konflikten – Grundsätze, Erarbeitet nach ZDv 15/2, Humanitäres Völkerrecht in bewaffneten Konflikten – Handbuch, DSK SF009320187, Bundesministerium der Verteidigung, R II 3, August 2006, p. 4.
In 2010, in the Fuel Tankers case, the Federal Prosecutor General at Germany’s Federal Court of Justice investigated whether war crimes or other crimes under domestic law had been committed in the course of an airstrike which was ordered by a colonel (Oberst) of the German armed forces against two tankers transporting fuel for the International Security Assistance Force in Afghanistan stolen by the Taliban near Kunduz and which resulted in the deaths of a number of civilians. The Federal Prosecutor General stated:
Pursuant to § 170 para. 2 StPO [Penal Procedure Code], the investigation proceedings which were initiated by the order of 12 March 2010 against Colonel (Oberst) Klein and Company Sergeant Major (Hauptfeldwebel) Wilhelm due to suspected offences under the VStGB [International Crimes Code] and other offences are to be terminated as a result of the investigations conducted and based on the sources of information set out hereafter and on the reasons given in detail hereafter. 
Germany, Federal Court of Justice, Federal Prosecutor General, Fuel Tankers case, Decision, 16 April 2010, p. 1.
The Federal Prosecutor General also stated:
Criminal responsibility under § 211 StGB [i.e. for murder under Germany’s Penal Code]
b)
Colonel (Oberst) Klein’s actions were lawful under international law and therefore justified under domestic criminal law …
cc)
Even considering the fact that the bombing killed civilians to be protected under the international law of armed conflict, the order to attack was lawful under international law.
(6)
The result that the order to attack was lawful under international law is not changed by the obligation in principle to give advance warning of attacks which may affect the civilian population (see Art. 57 para. 2 sub-para. c AP [1977 Additional Protocol] I; ICRC Customary IHL [Study] p. 62 ff). On the one hand, Colonel (Oberst) Klein justifiably assumed that the attack which he ordered would not affect civilians. On the other hand, this obligation contains the limitation that it may be excluded by the given circumstances. Thereby international humanitarian law acknowledges the legitimacy and military necessity of surprise attacks (see ICRC Customary IHL [Study] p. 64 …). This limitation applies in the present case because a warning could have defeated the legitimate military objective of killing Taliban. 
Germany, Federal Court of Justice, Federal Prosecutor General, Fuel Tankers case, Decision, 16 April 2010, pp. 59–67.