commit
Also called: commits
One saved step in a project's history: a snapshot of the files with an author, a date, a message and a unique id (hash). GitHub shows it as the changes against the previous commit.
A commit is like a saved version with a note attached: a snapshot of the whole project at one moment. Git stores it efficiently (unchanged files are not duplicated), and GitHub displays it as a diff, the lines that changed since the previous commit. Each commit points to its parent, so commits form a chain: the history. On GitHub a commit page shows the message, the author, the time, the short hash (such as 3f9a2c1) and the diff.
Example
Daniel's commit a41c09e "Raise delivery price to 59 UAH" changes one line in config/prices.json.
Common mistakes
Thinking a commit is published to users. A commit is only saved in the repository; whether it reaches the live site depends on the branch and the release process.
Learn it in the course
- Merging on GitHub: merge commit, squash and merge, rebase · What merging does, the three options behind GitHub's merge button (merge commit, squash and merge, rebase and merge) and what each leaves in the history, a fast-forward merge in plain words, and how to check whether a change is really in main.
- Repository and commits: reading a GitHub repo page · What a repository in GitHub is, its page from top to bottom, what a single commit tells you, and commit message best practices.
- Git branches: parallel versions of the project · What a Git branch is, why work happens on short-lived branches next to main, and how to read branches on GitHub: the branch selector, ahead and behind, stale branches, naming conventions and graphs with several lanes.
- Why teams keep history: version control without fear · What version control is, Git vs GitHub and how the two differ, and why looking around a repository can't break anything.
- Reading history: messages, diffs and blame · How to open a file's history, read a diff line by line and use blame to trace any line back to its commit, pull request and issue.