Method for operating a heating system comprising at least one heat source, which can be switched over between a heating mode and a cooling mode, for selectively cooling or heating a heat transfer liquid, in particular water, which is guided in a cooling and heating circuit in which the heat source is incorporated via a feed line and a return line, wherein the cooling and heating circuit has an air-conditioning branch and a hot water branch which are connected to the feed line via a first multiway valve and open into the return line, wherein at least one heat exchanger for controlling the temperature of an indoor climate is arranged in the air-conditioning branch and at least one hot water tank is arranged in the hot water branch, wherein the heating system is selectively operated in one of the following modes: a) heating mode in which heat is emitted to the heat transfer liquid by the heat source and/or an auxiliary heater and is emitted in the air-conditioning branch via the at least one heat exchanger, wherein the hot water branch is closed, b) cooling mode in which heat is received from the heat transfer liquid by the heat source, which heat is transmitted to the heat transfer liquid via the at least one heat exchanger in the air-conditioning branch, wherein the hot water branch is closed, c) hot water mode in which heat is emitted to the heat transfer liquid by the heat source and/or the auxiliary heater and is emitted to the hot water tank in the hot water branch, wherein the air-conditioning branch is closed, d) first intermediate mode for rapidly cooling the heat transfer liquid when a changeover is made from the hot water mode to the cooling mode, in which first intermediate mode heat is received from the heat transfer liquid by the heat source, wherein the hot water branch is closed and the heat transfer liquid is circulated through the feed line, at least one bypass connection (14, 17) between the feed line and the return line parallel to the air-conditioning branch, and a return line, characterized by a e) third intermediate mode for controlling the temperature of the heat transfer liquid when a changeover is made from the hot water mode to the heating mode, in which third intermediate mode heat is emitted to the heat transfer liquid by the heat source and/or by the auxiliary heater, wherein the hot water branch is closed and a greater quantity of heat transfer liquid is circulated through the air-conditioning branch via the bypass connection (14, 17) than is returned through the return line to the heat source. a) heating mode in which heat is emitted to the heat transfer liquid by the heat source and/or an auxiliary heater and is emitted in the air-conditioning branch via the at least one heat exchanger, wherein the hot water branch is closed, b) cooling mode in which heat is received from the heat transfer liquid by the heat source, which heat is transmitted to the heat transfer liquid via the at least one heat exchanger in the air-conditioning branch, wherein the hot water branch is closed, c) hot water mode in which heat is emitted to the heat transfer liquid by the heat source and/or the auxiliary heater and is emitted to the hot water tank in the hot water branch, wherein the air-conditioning branch is closed, d) first intermediate mode for rapidly cooling the heat transfer liquid when a changeover is made from the hot water mode to the cooling mode, in which first intermediate mode heat is received from the heat transfer liquid by the heat source, wherein the hot water branch is closed and the heat transfer liquid is circulated through the feed line, at least one bypass connection (14, 17) between the feed line and the return line parallel to the air-conditioning branch, and a return line, characterized by a e) third intermediate mode for controlling the temperature of the heat transfer liquid when a changeover is made from the hot water mode to the heating mode, in which third intermediate mode heat is emitted to the heat transfer liquid by the heat source and/or by the auxiliary heater, wherein the hot water branch is closed and a greater quantity of heat transfer liquid is circulated through the air-conditioning branch via the bypass connection (14, 17) than is returned through the return line to the heat source.