What happens to old transactions in case of a fork? I'm confused about forking. What happens to the 'old' version of a blockchain and related transactions/data in case of a fork. Can they still be deleted or does the new branch still depend on them to ensure continuity?
What happens to the 'old' version of a blockchain and related transactions/data in case of a fork. Can they still be deleted


In the case of a soft fork, historic data must be kept.  In the case of a hard fork, it's not strictly necessary to keep historic data but it is almost always retained.

Going in to a bit more detail: a soft fork changes the rules everyone follows in a backwards-compatible way by only making the rules more strict.  For example, miners have access to a field called the "coinbase" into which they used to be able to put any arbitrary series of 2 to 100 bytes; later a rule was added that specified in the BIP34 soft fork that the first few bytes of that field had to be the current block's height (distance from the first block).  This is more strict, so everyone who follows the new rule also automatically follows the old rules.  This is backwards compatible because anyone who followed the old rules and isn't already violating the new rules can continue to use their software as normal.

However, for that backwards compatibility to hold true, the data available in the block chain has to not only remain available but stay in basically the same format.  You can sometimes do tricks with that, as segwit did by moving signatures to a new field in transactions, but there's a limit to the scope of changes you can reasonably make.

For hard forks, there rules are changed in a backwards-incompatible way so everyone needs to upgrade anyway.  This gives you a blank slate upon which to make any change to the system you want.  Regarding old block chain history, what you can do is commit to the current state of the system and throw out all history used to arrive at that state.

For example, imagine Alice mines a bitcoin and then pays that bitcoin to Bob.  The block chain will include both the mining transaction and the payment transaction, but if everyone is upgrading anyway, it's simple to just say "Bob starts with 1 bitcoin" and throw away Alice's mining transaction.

If you were to throw away historic data and keep just the current state after a Bitcoin hard fork, you could reduce the current block chain size by about 98%, down to just a few gigabytes.

However, I'm not aware of any hard fork of Bitcoin or an altcoin that ever threw out the historic data and simply committed to the current state.  I don't know why that's the case.