Library › Coding AI › College students
Plan how to split one big diff into 3 commits
Practice: Asking for a format you can use. About 5 minutes.
About this exercise
Your team's capstone repo wants small commits. Plan exactly 3 commits from your staged changes, in the order refactor, then feat, then docs. Write each as one numbered line: '<subject> - files: <files>', with Conventional Commits subjects using scopes auth, auth and readme, each subject under 50 characters. Every staged file must appear in exactly one commit. No code blocks, under 90 words.
Common mistakes when you ask AI for this
- One giant commit. Asked for a commit message, the AI writes one message for everything. Try: Say: "Plan exactly 3 commits: refactor, then feat, then docs."
- Tests in their own commit. The AI often splits tests out, which breaks your team rule. Try: Add: "Tests go in the same commit as the code they test."
- Missing or doubled files. Without a check, a file can end up in two commits or none. Try: Add: "Every staged file in exactly one commit."
- A git tutorial. The AI explains git add -p and interactive staging at length. Try: Add: "One line per commit, no code blocks."
What a strong prompt includes
- Sets the number of commits
- Gives the order
- Gives the line shape
- Mentions the test rule
- Asks for full coverage
Related exercises
- Add a cron line that matches the others in a crontab (Coding AI · Product managers)
- Add dark mode by overriding your existing CSS variables (Coding AI · Software developers)
- Add input checks to your number guessing game (Coding AI · High school students)
- Add input validation to a Java method with exact messages (Coding AI · Software developers)
- Add labels to a signup form without rewriting the page (Coding AI · High school students)