# Git Commit Messages

> Format git commit messages correctly, avoiding HEREDOC syntax issues in favor of multiline strings Use when this capability is needed.

- Skill: `tomevault-io/git-commit-messages-2` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/git-commit-messages-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/git-commit-messages-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/git-commit-messages-2

---


# Git Commit Message Formatting

## When to Use This Skill

Use this skill when creating git commits with the Bash tool, especially for commits with:

- Multi-line messages
- Body text or explanations
- Co-authored-by footers
- Claude Code attribution

## Core Principle

**Avoid HEREDOC syntax** - Use `-m` with multiline strings instead.

## Pattern to Follow

### ✅ DO - Use multiline string with -m

```bash
git commit -m "feat(github): add github plugin

This adds comprehensive GitHub workflow support including
commands for PR management and review workflows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>"
```

**Key points:**

- Single `-m` flag with entire message in quotes
- Newlines preserved within the quoted string
- No special syntax or escaping needed
- Works reliably across all environments

### ❌ DON'T - Use HEREDOC syntax

```bash
# This FAILS in Claude Code's Bash tool
git commit -m "$(cat <<'EOF'
feat(github): add github plugin

This adds comprehensive GitHub workflow support.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
```

**Why this fails:**

- HEREDOC syntax has shell interpretation issues
- Fails in certain execution contexts
- More complex than necessary
- Unreliable across environments

## Examples

### Simple commit

```bash
git commit -m "fix: resolve path configuration issue"
```

### Commit with body

```bash
git commit -m "feat: add progressive disclosure pattern

Skills now support references/ subdirectory for
detailed documentation that loads on-demand."
```

### Full conventional commit

```bash
git commit -m "feat(tools): add git commit message skill

This skill teaches Claude to format git commit messages
using multiline strings instead of HEREDOC syntax, which
fails in certain shell environments.

The pattern uses a single -m flag with the entire message
in quotes, preserving newlines naturally."
```

## Why It Matters

Using `-m` with multiline strings is:

- **Reliable:** Works consistently in all environments
- **Simple:** No complex shell syntax needed
- **Portable:** Standard git behavior
- **Direct:** Git handles newlines correctly

HEREDOC syntax causes issues because:

- Shell interpretation varies by environment
- Execution context in Claude Code differs from terminal
- Quote handling becomes complex
- Unnecessary complexity for the task

## Quick Reference

- One `-m` flag
- Entire message in double quotes
- Newlines work naturally
- No HEREDOC needed

---
> Source: [boneskull/claude-plugins](https://github.com/boneskull/claude-plugins) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-19 -->

