Overview
Consider a project maintained by two developers.
Developer A changes files on one computer. Developer B changes files on another. Git tracks each developer's local history independently. When their work is ready to share, each developer pushes the relevant commits to GitHub. GitHub then provides the shared location where branches can be compared, reviewed, and merged.
A single developer also benefits from the same separation. Local Git provides version history even without an internet connection or remote repository. GitHub becomes useful when the developer wants an online copy, access from another computer, or a place to share the project.
A useful operating model is:
Local Git answers: "What versions have I saved on this computer?"
GitHub answers: "What versions and branches are available to the wider team online?"