Commit staged/unstaged changes, push to remote, and create a PR if one doesn't exist. Use when asked to "ship it", "commit push pr", "commit and push", "open a pr", or finish a feature.
Ship your changes in one workflow: commit, push, and open a PR if needed.
Announce at start: "I'm using the dev-commit skill to commit, push, and open a PR."
git status
git diff --stat
git log --oneline -5
Check what's staged, unstaged, and the recent commit history for message style.
Critical: Always use explicit file paths. Never use . or -A without a path.
# 1. Unstage everything first (prevents accidental inclusions)
git restore --staged :/
# 2. Stage only the specific files you want to commit
git add -A -- path/to/file1 path/to/file2
# 3. Verify what's staged
git diff --staged --stat
# 4. Commit with conventional message
git commit -m "$(cat <<'EOF'
<type>: <description>
<optional body>
EOF
)"
Conventional Commit types: feat|fix|refactor|build|ci|chore|docs|style|perf|test
Handling deletions: If a file was deleted, git add -A -- <path> still works to stage the deletion.
Stale lock errors: If commit fails with "Unable to create index.lock", remove it:
rm -f "$(git rev-parse --git-dir)/index.lock"
# Check if branch has upstream
if git rev-parse --abbrev-ref --symbolic-full-name @{u} >/dev/null 2>&1; then
git push
else
git push -u origin HEAD
fi
# Get current branch and default branch
current=$(git branch --show-current)
default=$(gh repo view --json defaultBranchRef --jq '.defaultBranchRef.name')
Skip PR creation if:
main/master) — just commit and push, donegh pr view --json url,state 2>/dev/nullQuick:
gh pr create --fill
With details:
gh pr create --title "<type>: <description>" --body "$(cat <<'EOF'
## Summary
- <bullet points>
## Test plan
- [ ] <verification steps>
EOF
)"
Output the PR URL when done.
git add . or git add -A without explicit paths — this stages everything including secrets.env, credentials, or secretsControl Philips Hue lights and scenes via the OpenHue CLI.