Bible Notes Online - 1-Samuel 29 - ESV
Commentary

v1: The Philistines moved from Shunem (28.4) to Aphek. This was not far from Mount Carmel. Jezreel, Endor, and Gilboa were all quite close. The plain and the fountain of Jezreel were here. Israel was beaten back, to Mount Gilboa.

v2-3: David was prepared to fight with the Philistines, and it seems certain that he knew they were fighting Israel, since they were within the borders of Israel.  Yet God’s hand was on the situation, and the likely military battle of David against Saul was averted.

v4-5: The princes of the Philistines took exception to David; they had heard the saying that had made Saul jealous; like Samson, David had multiplied their dead. They suspected his motives, and thought that he could have turned against them in the battle.

v6-10: Achish had no choice; David could not fight with the Philistine army. The princes had made their decision, and Achish had to abide by it. David had proved himself loyal to Achish; he called him, "my lord the king", just as he had called Saul (24.8).

v11: David left Philistia, and had no part in the battle at Gilboa. As in ch 25, David's integrity was preserved. We see clearly the hand of God here, ensuring that David did not fight against his own people. God had graciously overruled David's compromise and lack of wisdom.