In this article · 8 sections
Has a developer ever "fixed" something on your website and broken something else, with no way to undo it? Version control prevents that. Git records every change to your code, and GitHub (or GitLab/Bitbucket) stores that history online. This guide covers Git and GitHub for beginners, whether you own a website or are starting out as a developer.
Why it matters for business owners
- Undo mistakes: roll back to yesterday's working version in minutes
- Know what changed: every change has an author, date and description
- No lock-in: if your developer changes, the new one gets the full code and history
- Safer deployments: changes are tested before going live
Ask your developer: "Is our website code in a Git repository, and is the repository in our account?"
Key concepts
- Repository (repo): the project folder plus its full history
- Commit: a saved snapshot with a message ("Fix contact form email")
- Branch: a separate line of work (e.g.
new-design) that doesn't affect the main version until merged - Merge: combining a branch back into the main code
- Remote: the online copy (on GitHub)
- Pull request (PR): a request to merge changes, where they can be reviewed first
Basic commands
git init # start tracking a folder
git add . # stage changes
git commit -m "Add FAQ section to services page"
git branch new-design # create a branch
git switch new-design # move to it
git push origin main # upload commits to GitHub
git pull # download latest changes
git log --oneline # see history
A simple, safe workflow
- Keep
mainas the live, working version - Make changes on a branch
- Test on a staging site
- Merge to
mainand deploy - Tag releases (e.g.
v1.4) so you can return to them
What NOT to put in Git
- Passwords, API keys and database credentials. Use a config file that's excluded with
.gitignore - Large uploaded files (user uploads, backups)
vendor/ornode_modules/folders that can be reinstalled
If secrets were committed by mistake, change those passwords; deleting the file later doesn't remove it from history.
Private vs public repositories
Business code should be in a private repository owned by the business account. Add developers as collaborators and remove them when the work ends.
Deploying from Git
- Many hosts (including some shared hosting panels) can pull from a Git repository
- Automated deployment (GitHub Actions or similar) can upload changes after tests pass
- At minimum, developers can
git pullon a VPS or upload a tested release
FAQs
Is GitHub free?
GitHub offers free private repositories for individuals and small teams, with paid plans for advanced features. Check current plans.
Do WordPress sites need Git?
Custom themes and plugins benefit greatly. For the content itself (posts, pages), rely on database backups.
All custom projects at Joboo Web can be delivered with a repository in the client's own account. Ask us.