name: squash-session-commits description: Combine related Git commits from the current agent session into one commit per topic. Write a short, plain commit body.
Squash session commits
Squashing combines several commits into one. A session covers the current agent conversation, including its earlier turns.
Find the session commits
- Before the first change on each branch, record its starting
HEAD. - Keep a list of the commits you make in the session. Carry the list across turns.
- Before handing off work, compare the list with
git log <session-start>..HEAD. If the start or list is missing, use commit hashes from the conversation. Use only commits you can trace to this session. An author, date, or similar subject does not prove that a commit belongs to the session.
Make one commit per topic
- Read the changes in each session commit. Group all commits on the same feature, fix, or topic, even when other topics sit between them. Include tests and docs for that topic.
- Combine each group with two or more commits. Keep separate topics in separate commits. Put any change that another commit needs first. If a group cannot keep that order, leave it alone and explain why.
- Keep the rewrite local. If it would replace a commit from outside the session, leave that group alone and explain why. If it would replace a published or shared commit, get permission first. Preserve staged, unstaged, and untracked changes.
- Save the old branch tip in a temporary ref. Prepare the rewrite on a temporary branch or in a separate worktree. Before updating the original branch, make sure that
git diff --exit-code <old-tip> <new-tip>reports no file changes. Review the new log. If the original branch tip changed, stop and review the new commits. After updating the branch, record the new hashes in the session list.
Write the commit message
Use a Conventional Commits subject. Leave a blank line before the body. Write two or three short sentences that describe the result. Use plain words. Omit the order of edits, failed tries, and the list of commits you combined.
fix(avatar): show the saved photo at launch
The app shows the saved photo while the account loads.
It checks for a new photo in the background and saves it when it changes.