2018-02-05 02:27:07 +00:00
|
|
|
# Fixing commits
|
2019-11-23 16:05:04 +00:00
|
|
|
```bash
|
2018-02-05 02:27:07 +00:00
|
|
|
# Revert the last commit.
|
|
|
|
git revert HEAD
|
|
|
|
|
2018-02-08 18:25:03 +00:00
|
|
|
# Revert only the second to last commit. Etcetera
|
2018-02-05 02:27:07 +00:00
|
|
|
git revert HEAD~1
|
|
|
|
|
2018-02-08 18:25:03 +00:00
|
|
|
# Revert the last three commits, but stage the reversion locally.
|
|
|
|
git revert --no-commit HEAD~3..
|
|
|
|
|
2018-02-05 02:27:07 +00:00
|
|
|
# Reset working files to match master (or another branch), removing local changes and commits.
|
|
|
|
git fetch --all
|
|
|
|
git reset --hard origin/<branchName>
|
2019-11-23 16:05:04 +00:00
|
|
|
```
|