This is a topic I have discussed many times, so here are the highlights.
The Hague Conventions definition of 1907 is the only legal definition of occupation. That's it. The Fourth Geneva Conventions does not define it at all.
And here it is:
Art. 42. Territory is considered occupied when it is actually placed under the authority of the hostile army.
The occupation extends only to the territory where such authority has been established and can be exercised.
Amnesty International expanded on this definition when the US invaded Iraq:
The sole criterion for deciding the applicability of the law on belligerent occupation is drawn from facts: the de facto effective control of territory by foreign armed forces coupled with the possibility to enforce their decisions, and the de facto absence of a national governmental authority in effective control. If these conditions are met for a given area, the law on belligerent occupation applies. Even though the objective of the military campaign may not be to control territory, the sole presence of such forces in a controlling position renders applicable the law protecting the inhabitants. The occupying power cannot avoid its responsibilities as long as a national government is not in a position to carry out its normal tasks.Clearly, Gaza has a government that is not controlled by Israel, and just as clearly, occupation requires a physical presence on the territory itself.
The international legal regime on belligerent occupation takes effect as soon as the armed forces of a foreign power have secured effective control over a territory that is not its own.It ends when the occupying forces have relinquished their control over that territory.
The question may arise whether the law on occupation still applies if new civilian authorities set up by the occupying power from among nationals of the occupied territories are running the occupied territory’s daily affairs. The answer is affirmative, as long as the occupying forces are still present in that territory and exercise final control over the acts of the local authorities.
Interestingly, Amnesty never refers to their own definition when talking about Gaza.
They aren't the only hypocrites whose definitions of "occupation" changes only for Israel. The UN, when asked specifically how they can define Gaza as occupied, sputtered nonsense in response, saying that Gaza and the West Bank are considered a single territory, and therefore if the West Bank is occupied then Gaza must be too. This means that they disagree with The Hague 1907 definition which clearly defines occupation as being applied only to the part of territory under control. By the UN's definition, all of Cyprus would be occupied by Turkey because some of it is occupied by Turkey.
The UN also specifically denied that Libya was occupied by the US and allies when its situation was quite analogous to Gaza today.
HRW likewise has one definition of occupation for the world, and another one for Israel.
For those who want to get into more details, see this post about an ICRC-commissioned paper that went into considerable detail on not only the definition of occupation, for which there is near consensus, but also for when occupation ends.
Finally, see this post about how the ICRC gave more details on why they consider Gaza occupied despite the legal experts they hosted that say otherwise, and the complete demolition of that argument by an international law scholar, including his pointing out of obvious lies by the ICRC head.
Oh, and Hamas admits that Gaza isn't occupied.
In short, anyone who claims Israel occupies Gaza is making an argument that no one has ever made in respect to occupation anywhere else in the world. It proves yet again that when it comes to Israel, the very definitions of words are uniquely different for Israel.
(By the way, any territory that the IDF controls during the war would be considered occupied, and Israel would have legal obligations towards residents of the areas it controls. That situation is the exact reason there is a definition to begin with. But when Israel withdraws, Gaza goes back to being effectively controlled by its government, a government that Israel is powerless to change itself without a true occupation.)