Files
Advanced-Git/contents/git-replace-old-commit-new-commit.md
T
2025-07-09 01:19:53 +00:00

36 lines
607 B
Markdown

[⬅️ Back to Useful Rare Git Commands You Never Heard Of](./useful-rare-git-commands-you-never-heard-of.md)
# git replace <old-commit> <new-commit>
![Category: History](https://img.shields.io/badge/Category-History-blue)
> Temporarily substitute one commit for another.
#### Command
```sh
git replace abc123 def456
```
#### Examples
- **Temporarily replace commit abc123 with def456.**
```sh
git replace abc123 def456
```
#### Steps
1. Run `git replace <old-commit> <new-commit>` to test or patch history.
#### Tags
`replace`, `history`
#### Author
mike-rambil
#### Last Updated
2024-06-10