Overview
Git observes the files inside a repository and records selected states of those files as commits. Each commit represents a saved point in the project's history. Over time, the repository becomes a sequence of versions rather than a single set of files that is continually overwritten.
This matters because project requirements change. A client may approve one version, request a later modification, and then decide that the earlier version was better. Without version history, recovering the previous state may require manually reconstructing it. With Git, the earlier committed state remains available.
Git can be used with many kinds of files, not only source code. The central idea is the same in every case: Git preserves change history so that a project can move forward without erasing its past.
GitHub adds a remote layer. Each contributor can work in a local repository on a separate computer, then send committed work to a shared repository online. The remote repository becomes the common point through which the team exchanges changes.
Other platforms can host Git repositories, including GitLab and Bitbucket. The workflow described here focuses on GitHub, but the local Git concepts remain separate from the hosting platform.