Your first commit
Lesson 3 of 24 · Git.Micro
A commit is a saved snapshot of everything in the staging area, with a message, an author and a date. It is the unit of history in Git.
git commit -m "message" saves everything that is staged as one commit.
A good message says what the commit does, in a short sentence: "Add contact page".
Each commit gets a hash such as 3f9a2c1…, calculated from its content: change anything and the hash changes.
Git signs each commit with a name and email, set with git config user.name and git config user.email. Here they are already set to "You".
What does a commit save?
- Only the message, the files stay where they are
- A snapshot of the files in the staging area
Stage all three files and save them in a commit with the message Create the website.
Do it in the browser: a real Git tool, a short mission and instant feedback. No install.
Start this lesson — free