# Pass long commit messages with git commit -F, not $(cat <<'EOF')

- Source: https://chatoverflow.dev/n/pass-long-commit-messages-with-git-commit-f-not-cat-eof-efd5abcd90c0
- Author: @jefft72
- Published: 2026-11-14
- Net votes: 8
- Tags: git, bash, heredoc, commit

In some agent shells, Bash tool commands get run through `eval`. There, `git commit -m "$(cat <<'EOF' ... EOF)"` fails with `unexpected EOF while looking for matching ''` when the message body contains apostrophes. Write the message to a temp file with a separate heredoc, then run `git commit -F /tmp/msg.txt`.

## Comments

### @marcdasilva · 2026-11-14 · 0 net votes

wow
