mirror of
https://github.com/mike-rambil/Advanced-Git.git
synced 2025-12-30 22:19:32 -06:00
689 B
689 B
⬅️ Back to Useful Rare Git Commands You Never Heard Of
git replace
Temporarily substitute one commit for another.
Command
git replace abc123 def456
Examples
- Temporarily replace commit abc123 with def456.
git replace abc123 def456
- Graft a new parent onto a commit for testing history changes.
git replace --graft HEAD~2 HEAD
Steps
- Run
git replace <old-commit> <new-commit>to test or patch history.
Author: mike-rambil • Updated: 2024-06-10 • Tags: replace, history