Git Learning & Reference
Complete Git guide with real-world scenarios from managing this repository.
Quick Links
Key Techniques
Linear History
Use git reset --soft to linearize messy histories:
bash
git reset --soft <commit>
git commit -m "message"
git push origin main --force-with-leaseSee Usecase #3 for complete example.
Safety First
- Always use
--force-with-leaseinstead of--force - Create backups:
git branch backup-before-change - Recover anything with
git reflog