Skip to content

Git Learning & Reference

Complete Git guide with real-world scenarios from managing this repository.

  • Commands - Common git commands by category
  • Usecases - Real scenarios with solutions

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-lease

See Usecase #3 for complete example.

Safety First

  • Always use --force-with-lease instead of --force
  • Create backups: git branch backup-before-change
  • Recover anything with git reflog

Released under the MIT License.