Beginner level · Module 5: Publishing a Website · Lesson 1 of 3
Version Control with Git
Record your work with Git commits and back it up to a remote repository on GitHub.
In this lesson you will
- Initialise a repository and make meaningful commits
- Push a repository to GitHub
Key concepts
repositorycommitremote and push.gitignore
The lesson
Git records snapshots of your project called commits. git init starts a repository, git add selects changes, git commit -m "Add services section" records them with a message, and git log shows the history.
Commit small, related changes with messages that explain what and why. If something breaks, you can see exactly what changed and return to a working version.
A remote repository on a service such as GitHub backs up your work and is often what hosting services publish from. git push sends your commits to it. List files that should never be shared, such as passwords, in .gitignore.
Step by step
- Initialise a repository in the site folder.
- Make three commits with clear messages.
- Create a GitHub repository and push to it.
- Add a .gitignore file.
Practice activity
Put the organisation website under version control with at least five meaningful commits pushed to GitHub.
Expected result: The repository on GitHub shows the full site and a readable history.
Check your understanding
-
What does git commit do?
Show answer
Records a snapshot of the staged changes with a message.
-
What belongs in .gitignore?
Show answer
Files that should not be tracked or shared, such as secrets and generated files.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.