I once gained 30 pounds in 6 months, lost it the next 6 months. Came to a realization that I needed to change after ripping my pants at work bending over - mortified.
Did it by eating 90% raw vegetables and egg whites. That was over 10 years ago. I still stay healthy by following these rules: 1) containerizing all healthy lunches beginning of the week so I can grab and go (I eat the same thing every day to simplify shopping and packing; we do it for the kids too), 2) pre-cook M-W dinners (leaves a little space for variation if we want to skip one and then eat another day without wasting), 3) lots of egg whites (only way to cook en mass and have easy peeling is by steaming) and veggies (I vary dips to keep me from getting tired of it; also more recently I have been stuffing egg whites in low calorie soups); 4) drink water constantly, especially before meals (I keep 100 ounces on my mind and count out ~25 ounce bottles until I get there each day).
Also, before all that, I made a chart of all foods I liked, regardless of how healthy they are, calculated calories per gram (weight), and then sorted with the lowest calories per gram at the top and drew a line where I reasoned that I could eat tons from there on up the list without having to count calories all day.
I recently started low carb combined with intermittent fasting. Keep carbs under ~55 g per day, eat only between noon and 8pm (except Sundays 8am so I can enjoy an egg white omelet). Lost 12 lbs in just under a month, very noticeable in the face and chest.
Lots of water, black coffee or tea, some sweeteners or diet drinks are acceptable and won't break the fast.
I find it easier to follow than the more restrictive keto type diets. Gives some wiggle room to have flavor and not go overboard. Gave up beer, but you can do well with seltzer or liquor. Tito's mixes well with low-carb drinks.