genealogytree same ancestor

I try to build a genealogytree with a loop/circle inside; i.e. there is a node with gggreat-grandparents occuring twice.

To simplify the problem I have tried to create a tree which shows the problem:

Here is a complete version g-father1 and g-father2 should be brothers with the same parents A and B.

\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
\section{First Test}
\begin{tikzpicture}
\genealogytree{
parent{
g{child}
parent{
g{father}
p{g-mother1}
parent{
g{g-father1}
p{A}
p{B}
}
}
parent{
g{mother}
p{g-mother2}
parent{
g{g-father2}
p{A}
p{B}
}
}
}
}
\end{tikzpicture}
\end{document}

• Welcome to TeX.SX! Please add the code of a small complete document (starting with \documentclass and ending with \end{document}) that illustrates your problem. Just edit your question using the Edit button at the bottom left. Feb 7 '21 at 20:35
• Thank you. I have modified the example to a complete one. I hope that helps. Feb 8 '21 at 12:10

• Connect the common ancestor only to one of the families.
• Assign names to the ancestors and the other child using the id option.
• Add the missing lines with a \draw command.

\documentclass{article}
\usepackage[all]{genealogytree}
\begin{document}
\begin{tikzpicture}
\genealogytree{
parent{
g{child}
parent{
g{father}
p{g-mother1}
parent{
g{g-father1}
p[id=A,tikz={yshift=4mm}]{A}
p[id=B,tikz={yshift=4mm}]{B}
}
}
parent{
g{mother}
p{g-mother2}
p[id=g-father2]{g-father2}
}
}
}
\draw[green!40!black,line width=1pt] ([xshift=3mm]A.south) -- ++(0,-3mm) -| (g-father2);
\draw[green!40!black,line width=1pt] ([xshift=3mm]B.south) -- ++(0,-3mm) -| (g-father2);
\end{tikzpicture}
\end{document}

• Thank you for your fast and helpful solution! Feb 8 '21 at 19:40