Passage
And David rose up early in the morning, and left the sheep with a keeper, and took his charge and went, as Jesse had commanded him. And he came to the wagon-defence; and the host which was going forth to the battle-array shouted for the fight.
Nearby Context
1 Samuel 17:18 and carry these ten cheeses to the captain of the thousand, and visit thy brethren to see how they are, and take a pledge of them.
1 Samuel 17:19 Now Saul, and they, and all the men of Israel [were] in the valley of terebinths, fighting against the Philistines.
1 Samuel 17:20 And David rose up early in the morning, and left the sheep with a keeper, and took his charge and went, as Jesse had commanded him. And he came to the wagon-defence; and the host which was going forth to the battle-array shouted for the fight.
1 Samuel 17:21 And Israel and the Philistines put the battle in array, rank against rank.
1 Samuel 17:22 And David left the things he was carrying in the hand of the keeper of the baggage, and ran into the ranks, and came and saluted his brethren.
Study Lenses
The verse centers on "sheep", "david", "rose", "early", "morning", "left", "keeper", and "took". It is saying that the verse draws attention to "sheep" and "david", so its meaning should be read from those terms before moving to application.
The nearby context moves from verse 19's "Now Saul and they and all the..." into verse 21's "And Israel and the Philistines put the...", so "sheep" and "david" belong inside that flow. In 1 Samuel context, the local focus is covenant, worship, and faithfulness.
A plain takeaway is to answer the verse's own emphasis on "sheep" and "david" with trust shaped by these words, not by a vague optimism outside the passage.