Projects

Git for Beginners: Version Control in Plain English

Git for Beginners – Git for Beginners: Version Control in Plain English

In this guide: Git for beginners explained in plain English: what version control is, installing Git, your first commit, branches and merging, and pushing to GitHub.

Have you ever edited your website’s code, broken something, and wished you could just go back to yesterday’s version? That’s exactly what Git does. It’s a version control system that tracks every change to your files, so you can undo mistakes, experiment safely, and collaborate without overwriting each other’s work.

What version control is

Version control is a system that records changes to files over time. Think of it as an unlimited, organized “undo history” with notes.

With Git, you can:

  • Save snapshots of your project (called commits).
  • See exactly what changed, when, and why.
  • Go back to any previous version.
  • Work on new features in separate branches without affecting the main code.
  • Collaborate with other developers and merge their work.
  • Back up your code to online services like GitHub, GitLab, or Bitbucket.

A few key terms:

  • Repository (repo): a project folder tracked by Git.
  • Commit: a saved snapshot with a message describing the change.
  • Branch: a separate line of development.
  • Merge: combining changes from one branch into another.
  • Remote: a copy of the repository hosted online (like GitHub).
  • Push / Pull: send commits to / get commits from the remote.

Installing Git

  • Windows: download Git for Windows from git-scm.com. It includes Git Bash, a terminal.
  • macOS: run git --version in Terminal; if Git isn’t installed, macOS prompts you to install developer tools. Or install via Homebrew.
  • Linux: use your package manager, e.g., sudo apt install git.

Then set your name and email (used in commit history):

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Prefer visual tools? GitHub Desktop and the Git features built into code editors like VS Code make Git easier to learn.

Your first commit

  1. Create or open a project folder in your terminal:
    bash
    cd my-website
    git init

    This creates a hidden .git folder that stores history.

  2. Check the status:
    bash
    git status

    Git lists untracked files.

  3. Stage files (choose what goes into the next snapshot):
    bash
    git add index.html style.css
    # or stage everything:
    git add .

  4. Commit with a clear message:
    bash
    git commit -m "Add homepage layout and base styles"

  5. View history:
    bash
    git log --oneline

Good commit messages describe what and why: “Fix mobile menu overlapping header” is better than “update.”

Create a .gitignore file to exclude files you shouldn’t track — like node_modules/, .env files with passwords, or WordPress wp-config.php with database credentials. Never commit passwords or API keys.

Branches and merging

Branches let you work on something new without risking your working code.

git branch                      # list branches
git switch -c new-contact-form  # create and switch to a new branch
# ...make changes, add, commit...
git switch main                 # go back to main
git merge new-contact-form      # bring the changes into main

If two branches change the same lines, Git reports a merge conflict. Open the file, choose which changes to keep, remove the conflict markers, then add and commit.

Common workflow:

  • main = stable, live-ready code.
  • Feature branches for each new change.
  • Merge when tested.

Pushing to GitHub

  1. Create a free account on GitHub and create a new repository (empty, no README if you already have files).
  2. Connect your local repo:
    bash
    git remote add origin https://github.com/yourname/my-website.git
    git branch -M main
    git push -u origin main
  3. From now on, after committing:
    bash
    git push
  4. To get changes from collaborators:
    bash
    git pull

For secure authentication, GitHub uses personal access tokens or SSH keys instead of passwords — see SSH Keys vs Passwords.

Many hosts and platforms can deploy directly from Git, so pushing to your main branch updates your live site automatically.

Further reading: MDN Web Docs learning area

Key Takeaways: Git for Beginners

  • Git saves snapshots of your project so you can undo mistakes and collaborate.
  • Learn the core loop: git add → git commit → git push.
  • Use branches for new features and merge when ready.
  • Use .gitignore and never commit secrets.
  • GitHub backs up your code and can power deployments.
Z
zasma171

Writes for Hostreta about the topics covered in this article.

Comments (0)

Your email address will not be published. Required fields are marked *

Recent Comments

No comments to show.
Ad · AdSense
Ad space 300×250
Affiliate links
Tools we recommend
Protect Your Website with Automated Daily Backups
$2.09
Get it
the easiest way to manage all of your social media accounts
$29
Get it
Starter Website Get online, properly
$249
Get it
google workspace Business Starter
$3.75
Get it
Nord Vpn Cybersecurity. Built for Everyday Use
$8.99
Get it

We may earn a commission on purchases made through these links, at no extra cost to you.

Ad · AdSense
Ad space 300×600
Ad · AdSense
Ad space 300×600

$ top hosting picks

affiliate
★★★★★

NovaHost

$2.95/mo,renews at $9.95
  • Free SSL + domain, first year
  • 1-click WordPress install
  • 24/7 chat, sub-5-min response
get this deal →
affiliate link · we may earn a commission
★★★★★

CloudRoot

$4.50/mo,renews at $12.95
  • Built-in CDN + caching
  • Daily backups, 30-day retention
  • Staging environments included
get this deal →
affiliate link · we may earn a commission
★★★★★

ByteForge

$3.75/mo,renews at $10.95
  • NVMe storage on every plan
  • Unlimited bandwidth
  • Free migration from your old host
get this deal →
affiliate link · we may earn a commission

Never miss a new article

Join thousands of developers and builders getting a weekly digest of the best tech articles.