The model
Git records snapshots and relationships between commits. A branch is a movable reference to a commit; creating a branch is cheap because it does not copy the repository. This model supports parallel work, review, and recovery when changes are small and their intent is clear.
A concrete walk-through
A commit records a tree plus metadata and parent references. A merge combines histories while preserving their ancestry; a rebase reapplies commits onto a new base and changes their identities. Pull requests use these histories to make a proposed change reviewable before integration.
Costs and failure cases
Git does not automatically make a change correct or safe. Large mixed-purpose commits obscure intent, and rewriting a shared branch can disrupt collaborators. A clean history helps investigation, but preserve the original evidence when correcting a production incident.
Check your understanding
A feature branch contains one implementation commit and one unrelated formatting commit. Explain how splitting the changes improves review and how rebase affects commit identifiers.