
Git is version control software that records changes to your code so you can track history, undo mistakes and work in parallel using branches. GitHub is a website that hosts Git repositories online for backup, sharing and collaboration. Beginners need a handful of commands: init or clone, add, commit, push, pull and branch.
Why version control matters
Without version control, projects end up with files like final.html, final2.html and final-REAL.html. Git replaces that chaos. Every saved change (a commit) is recorded with a message, so you can see what changed, when and why, and return to any earlier version.
Git vs GitHub
- Git runs on your computer and tracks changes.
- GitHub stores repositories online. Similar services include GitLab and Bitbucket.
Key concepts
- Repository (repo): a project folder tracked by Git.
- Commit: a snapshot of changes with a message.
- Branch: a separate line of work, so you can try features without breaking the main version.
- Merge: combining a branch back into the main branch.
- Remote: the online copy, such as on GitHub.
- Pull request: a request to merge changes, with space for review and discussion.
Essential commands
git init # start tracking a folder
git status # see what has changed
git add . # stage changes
git commit -m "Add contact form" # save a snapshot
git branch feature-login # create a branch
git switch feature-login # move to the branch
git push # upload commits to GitHub
git pull # download the latest changes
git clone <url> # copy a repository
A first workflow
- Create a repository on GitHub.
- Clone it to your computer.
- Make a small change and commit with a clear message.
- Push to GitHub.
- Create a branch for a new feature, commit there, push, and open a pull request.
- Review the changes and merge.
Writing good commit messages
Use short, specific messages in the present tense: "Add login validation", "Fix mobile menu overlap". Avoid "update" or "changes".
GitHub for your career
Your GitHub profile acts as a public record of your work. Pin your best projects, write READMEs, and commit regularly. Employers and clients often look at it. See how to build a portfolio website.
Never commit secrets
Do not push passwords, API keys or private data. Use a .gitignore file and environment variables. If a key is pushed accidentally, revoke it immediately; deleting the commit is not enough.
Frequently asked questions
Do I need to use the command line?
It is worth learning, but code editors and GitHub Desktop offer visual alternatives.
Is GitHub free?
GitHub offers free accounts with public and private repositories, with paid plans for extra features.
When should a beginner start using Git?
From your first real project. It is easier to build the habit early.


