git history

Patching & Rewriting

Rewrite commits with simple subcommands (experimental)


The 'git history' command is a newer, experimental way to rewrite history without an interactive rebase, for example changing an old commit's message in one command. It is newer than the Git version this site verifies against (2.48), and its options may still change.

Synopsis

git history reword <commit>
[ ] optional| or<arg> placeholder... repeatable--flag option

Examples

Change an old message

git history reword HEAD~2

Opens the editor for that commit’s message.

Workflow Examples

1
git history reword HEAD~2

Edit the message

2
git log --oneline

Check the result

Troubleshooting

git: 'history' is not a git command

Cause: Your Git is older than this experimental command

Use git rebase -i

Tips & Pitfalls

Best Practices

  • ✓Only rewrite commits you have not pushed.

FAQ

A:

No, it is marked experimental; prefer git rebase -i for now.