How To Lose Data With Git Reset
Aug 14, 2021
The aim of this anti-playbook🏁 is to outline steps for losing your (albeit saved) changes just by running git reset --hard
. This seems irreversible.
1. steps/notes
- you commit a file
- you change a tracked file (file already commited) in the working area and do not commit it the change
- you run
git reset --hard
- the branch is moved to the HEAD
- the state HEAD of that move is copied both to the index and the working area
- if you made any changes to either working area/index, that’s all irreversibly lost
- intentionally, it is a nice way to discard your changes, or course :)
- rule: no commit, no restore