Files
Advanced-Git/contents/git-replace-old-commit-new-commit.md
2025-07-11 01:17:06 +00:00

599 B

⬅️ Back to Useful Rare Git Commands You Never Heard Of

git replace

Category: History

Temporarily substitute one commit for another.

Command

git replace abc123 def456

Examples

  • Temporarily replace commit abc123 with def456.
git replace abc123 def456

Steps

  1. Run git replace <old-commit> <new-commit> to test or patch history.

Author: mike-rambil • Updated: 2024-06-10 • Tags: replace, history