The general rule is that a minister will abstain in an EU vote if the Cabinet cannot agree on a common position.
The most recent deviation from this rule was back in November 2017, when then-Agriculture Minister Christian Schmidt of the CSU voted in favour of a proposal to extend the approval of the herbicide glyphosate, despite his SPD colleague and Environment Minister Barbara Hendricks opposing the proposal. Schmidt was reprimanded by Chancellor Merkel, although not dismissed from his role; as the Süddeutsche Zeitung reports:
Angela Merkel has criticized her agriculture minister for saying yes
to glyphosate. The fact that Christian Schmidt had the license
extension voted on in the EU violated the government's rules of
procedure. "That did not correspond to the directives that had been
drawn up by the federal government," Merkel told press representatives
in Berlin. This also applies to an executive cabinet.
Germany voted in Brussels for an extended license for the weed killer.
Schmidt gave instructions to vote yes, although Environment Secretary
Barbara Hendricks disagreed. Since the CSU minister and the SPD
minister did not agree, Germany should have abstained.
Almost every day, Germany has to abstain from EU votes because of disagreements between departments, even if it is often "painful" for the ministers concerned, said the Chancellor. Today she spoke to Christian Schmidt about his behavior. She also asked the head of the Chancellery to clearly point out this rule to all departments. She expects nothing like this to happen again. "It's something that must not be repeated." Otherwise "joint work in the federal government is not possible".
Merkel referenced the Rules of Procedure of the Federal Government, which state that disagreements of opinion between ministers should be resolved within Government.