I'll talk a bit about your options if you stay with the company in a minute. But first things first: Your best course of action is to find a better job. Starting now. I will explain that some options of staying on board may come with a somewhat okay amount of money, but they also come with giving up control, with always waiting for the other side to make a move, with uncertainty and doubt.
Your best course of action is to take control of your (work)life and go find a better job. On your terms.
So what are your options?
They cannot fire you. Firing means they have a problem with you personally, and they want someone else to do this job. There are hurdles to this in Germany and "we don't have work for them" is not a valid reason.
They can lay you off. That means your job is no longer needed (commonly referred to as "Jobabbau") and you will not replaced by someone else. They are required to offer you a similar job at the company, if one exists. This is to close loopholes where a company "lays someone off" in Team A and then hires someone else in the same role for Team B. That is just a firing disguised as layoff and not allowed.
But your company genuinely has no work for you, so they will lay people off sooner or later. This is common after mergers, after all the merger should save overall costs and the easiest way is to let redundant people go.
They might not actually let you go though. In contrast to other countries, in Germany, the company cannot pick who they let go in a layoff. Because that would be personalized and then it would be a firing, not a layoff. Layoffs need a "Sozialplan" to determine who actually has to go. If there are ten developers, most likely the young, well educated singles need to go first. If they let the only accountant go, well, I guess the Sozialplan for one will include the one. Not much wiggle room there. But whether you will be layed off is not certain, if you have colleagues who do roughly the same job as you.
In contrast to other countries, there is no severance pay in Germany. A company can pay, whatever they want as severance, but the mandatory minimum and normal amount is zero. After all you have a notice period of multiple weeks if not months, that is enough of a safety net. You will not get extra money for getting laid off. If you have a strong union, you may get some severance pay in exchange for them keeping their lawyers out of it, but it is unlikely that you are member of a union or your company if heavily unionized if it's in IT. We tend to make enough money to not care for unions in IT.
If you get laid off, you might be able to negotiate that they pay you your full salary that you would have gotten during your notice period and let you go immediately in exchange for a signature that you will not sue them. Although suing them has basically zero chance and zero means of making you money in Germany, it would be a risk in their books and the last thing they want is risk in their books. They want to get rid of people and if they can do that by paying you what they have to pay you anyway, then all the better. Your advantage here is that you get paid for another month or two or three (depending on your notice period), but can start working in another job immediately. This is nice... but lets face it, its not exactly riches, a lot of contract signing and haggling and it's all dependent on their goodwill. They could just say "nah, we don't do that, we have a company lawyer, just sue if you feel like it". Which they know you will not do, because... the maximum you could get from them is the difference between your current salary and your new salary. Lets say you make X per month and get fired. You find a new job, where you make exactly X, too. You sue the old company and after a year in court you win. You will get damages awarded, the amount of money you lost by being fired unfairly... in this example, exactly zero, because you found a new job that makes just as much as the old one.
So bottom line: whether you get laid off is a bit of a roulette. Unless they lay of all of your colleagues in the same job, you might stay on board. Or not. If you do get laid off, you will get nothing for it. If you are smart and they are smart, you might get a month or two of salary. But that is not guaranteed at all.
So I will repeat my advice from above: unless you are in a heavyly unionized job and there is talk about severance, take action and control your own life. Finding a job will be easier if it is on your terms and without a bunch of your colleagues being laid off at the same time, looking for a job, too.