Git स्थिति के आधार पर बदलावों को undo करने के कई तरीके प्रदान करता है — uncommitted बदलावों को छोड़ना, unstage करना, अंतिम commit को amend करना, किसी commit को revert करना, या reset करना। प्रत्येक स्थिति के लिए सही टूल जानना एक महत्वपूर्ण, मूल्यवान व्यावहारिक कौशल है।
uncommitted बदलावों को undo करना (working directory)
git restore <file> # discard unstaged changes to a file (revert to last commit)
git checkout -- <file> # older equivalent
git restore . # discard ALL unstaged changes (careful!)
git clean -fd
