We conduct a public goods game experiment on cooperation and punishment in changing groups. We arbitrarily categorize participants into three colours: blue, red, or green*. Each participant receives an endowment of 20 monetary units and can choose to keep these units in a private account that only benefits oneself or to contribute them to two types of public goods: a colour-specific public good that gives a return of 0.7 to members of one's own colour and a global public good that gives a return of 0.5 to all members regardless of their colour. There are four members per group. In the first part of the experiment, we let participants play 10 rounds of the public goods game in their group in one of two conditions. This repeated interaction allows participants to develop group norms on how much to contribute to each of the two public goods. In one condition, groups are homogeneous in terms of colour. In the other condition, groups are heterogeneous in terms of colour (i.e., 2 members of one colour are matched with 2 members of another colour). After the first 10 rounds of the public goods game, we replace 2 members per group with 2 new members from another group and start the second part of the experiment. In the condition where groups were homogeneous prior to membership replacement, the replacement leads to heterogeneous groups (e.g., in a group with 4 blue members, 2 of the blue members are replaced by red members). We refer to this condition as HOM-HET. In the condition where groups were heterogeneous prior to membership replacement, the replacement leads to homogeneous groups (e.g., in a group with 2 blue and 2 red members, the 2 red members are replaced by 2 blue members). We refer to this condition as HET-HOM. The reshaped groups in both conditions then play another 10 rounds of the public goods game. In both conditions, we additionally vary whether peer punishment is possible, giving a total of 2 x 2 = 4 sub-conditions: 1: groups that move from homogeneity to heterogeneity due to membership change, without the option to peer-punish, 2: groups that move from heterogeneity to homogeneity due to membership change, without the option to peer-punish, 3: groups that move from homogeneity to heterogeneity due to membership change, with the option to peer-punish, 4: groups that move from heterogeneity to homogeneity due to membership change, with the option to peer-punish. * three colours are needed when there is an uneven number of groups in the laboratory and we want to switch members between groups such that each reshaped group consists of two members of one colour and two members of another colour. With an even number of groups, we only use red and blue colours.