15 lines
383 B
Markdown
15 lines
383 B
Markdown
# Fixing commits
|
|
```
|
|
# 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>
|
|
``` |