- Git tracks the history of your code on your computer, and GitHub stores it online.
- Learn five commands first: init, add, commit, push and pull.
- Use branches and pull requests so changes can be reviewed before they go live.
The Short Answer
Git is a version control tool that records every change you make to your files, so you can go back if something breaks. GitHub is a website that stores Git projects online so you can back them up, share them and work with others. Together they are the standard way developers save and collaborate on code, and they are also a great place to show employers and clients what you have built.
Git vs GitHub
| Git | GitHub | |
|---|---|---|
| What it is | A tool on your computer | An online service |
| Purpose | Track changes and history | Store, share and review code |
| Needs internet | No | Yes |
The Five Commands to Learn First
git initstarts tracking a folder.git add .prepares your changes.git commit -m "message"saves a snapshot with a short description.git pushsends your commits to GitHub.git pullbrings down the latest changes.
Write clear commit messages, such as 'Add contact form', so future you understands what happened.
Publish Your First Project
- Create a free GitHub account.
- Click New repository, give it a name and create it.
- On your computer, run
git initinside your project folder. - Run
git add .thengit commit -m "First commit". - Copy the commands GitHub shows to connect and
git pushyour code.
Add a README file explaining what the project does and how to run it.
Branches and Pull Requests
A branch is a safe copy where you can try changes without touching the main version. When you finish, you open a pull request so someone can review it before it is merged. This habit is especially useful when AI tools write code for you, as explained in reviewing AI-written code.
Keep Secrets Out
Never commit passwords, API keys or private files. Use a .gitignore file to exclude them. For safer password habits, see our password manager guide.
Action Checklist
- Create a GitHub account
- Learn the five basic commands
- Commit small, clear changes
- Use branches for new features
- Add a README to every project
- Keep secrets out with .gitignore


