Question:
What happens when your perform a git reset --soft HEAD~1?
When you run:
git reset --soft HEAD~1Git:
- Removes the last commit locally (only on your dev machine).
- Keeps the changes in your working directory and stages them for recommitting.
It only affects your local repository and cannot be run if the commit has already been pushed to GitHub.
In that case, you’d need to use: git reset --hard HEAD~1 to remove the commit locally, followed by: git push --force to overwrite the commit on GitHub.
Taxonomy: