16 lines
388 B
Markdown
16 lines
388 B
Markdown
# Fixing commits
|
|
```bash
|
|
# Revert the last commit.
|
|
git revert HEAD
|
|
|
|
# Revert only the second to last commit. Etcetera
|
|
git revert HEAD~1
|
|
|
|
# Revert the last three commits, but stage the reversion locally.
|
|
git revert --no-commit HEAD~3..
|
|
|
|
# Reset working files to match master (or another branch), removing local changes and commits.
|
|
git fetch --all
|
|
git reset --hard origin/<branchName>
|
|
```
|