Use this guide when you have committed the wrong thing, broken your branch or think you have lost work in Git. Have a terminal open in the project folder and avoid running any more commands until you have read step 1.
Step by step
Stop and take a snapshot
Run git status and git log --oneline -10 and copy the output into a note so you know exactly where you started. If you are worried, copy the whole project folder, including the hidden .git folder, before trying anything. Most Git mistakes are recoverable as long as you do not keep piling on new commands in a panic.
The rest of this guide is for members
The rest of this guide – the remaining steps, a ready-to-use checklist, practical tips and fixes for common problems – is for members. Membership unlocks every ABCDayZ guide.
£3.99 for 1 month or £29 for 12 months. One payment, no automatic renewal.
Unlock all guidesAlready a member on another device? Open your personal access link. Bought Programming with AI? Your first month is included.