Codex CLI commit log with "\n" in the message

Resolved 💬 3 comments Opened Sep 3, 2025 by doggy8088 Closed Sep 3, 2025
💡 Likely answer: A maintainer (gpeal, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

codex-cli 0.28.0

Which model were you using?

gpt-5

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

  1. Write some code
  2. Enter this prompt: git commit with detailed log using zh-tw

What is the expected behavior?

I expected the newline to be rendered correctly.

What do you see instead?

The result:

<img width="1869" height="640" alt="Image" src="https://github.com/user-attachments/assets/55ae3789-a587-4158-a41e-1ff0d41e29eb" />

The "\n" is wrong.

Additional information

I have to rewrite the prompt like this:

rewrite your log. The newline must be REAL newline. amend it.

I believe this requirement is common. Instructions for how to perform a Git commit should be included in the default system prompt.

View original on GitHub ↗

3 Comments

michalkos · 11 months ago

You can try to create a prompt in ~/.codex/prompts/commit.md.

Create a git commit with detailed log using zh-tw.

**When adding new lines to commit message, use multiple `-m`s**. Example: `git commit -m "feat: new feature" -m "- description of the feature 1" -m "- description of the feature 2"`.

then write /commit into prompt line

gpeal contributor · 11 months ago

Feel free to do what @michalkos mentioned or add it to your AGENTS.md

doggy8088 · 11 months ago

Here is the prompt of mine:

~/.codex/prompts/commit.md

`````
Create a git commit with detailed log using zh-tw.

When adding new lines to commit message, use single quote to multi-line text..

If there is a single quote in the message, use standard bash syntax to escape that single quote.

Example:

git commit -m 'feat: new feature

- description of the feature 1
- description of the feature 2'\''s sub-feature
'

`````