\version "2.21.0"
<<
\new Staff {
c'4 d' e' f'
\repeat volta 2 {c' d' e' f' | g' a' b' c''}
}
\new ChordNames \with { chordChanges = ##t } {
g1 \once \unset chordChanges \repeat volta 2 {g1|1}
}
>>
Thank you David, this is what I wanted!
In the meantime I also found another working solution, but it's not neat. I post it here anyway:
\version "2.21.0"
<<
\new Staff {
c'4 d' e' f'
\repeat volta 2 {c' d' e' f' | g' a' b' c''}
}
\new ChordNames \with { chordChanges = ##t } {
g1 \once \unset chordChanges \repeat volta 2 {g1|1}
}
>>
g.