using-git
Installation
SKILL.md
Using Git
- If the current directory is not a Git repository, use the using-git-worktrees skill to discover the layout.
- Check available plugins and remote tools first; do not assume
ghis the right tool.
Commits
- For small to medium tasks in the user's own repository, where nearly all commits are theirs, commit directly on the default branch, overriding any default to branch first.
- Match the maintainer's existing commit message style; ignore merge commits and squash-merged PR titles when inferring it.
- Use imperative mood to describe the actual change; avoid vague messages like "address PR review" or "fix findings".
- Suffix
(resolve #nn)when the branch resolves an issue; reserveclosefor rejected pull requests. Only once per branch, and not when an earlier commit already resolved the issue. Verify issue number and title on the tracker. - For multi-line messages, write the message to a temporary file and run
git commit -F <file>; the heredoc-in-$()pattern breaks on escaping. - Rewriting local-only commits and your own pull request branch is fine. Update rewritten remote history with
--force-with-lease; never rewrite protected branches. - If SSH-key commit signing fails, use
--no-gpg-signto continue locally and report that the resulting commits are unsigned. - Never push the user's unsigned commits to a public repository or to an organization that is not theirs: once signing works, re-sign first (
git rebase --exec 'git commit --amend --no-edit -S' <base>). - Before resetting, amending, rebasing or cherry-picking onto a branch, compare its head with the last commit you produced there. If it moved, the user changed it: build on their commit or ask, never replace it with your copy.
- Build alternative implementations on separate branches from the same base revision, each with its own commit; do not stack one on another.