The Glory of Israel will not lie or have regret, for he is not a man, that he should have regret.
1 Samuel 15:29 ESV
God is incapable of regret/repentance because he always knows exactly what he is doing and why, but God is grieved by some necessities. When Scripture says that he regrets or repents of something, the literal meaning of the Hebrew is that he turns away from something or changes course, not that he decided what he was doing before was wrong.