Sitemap
Trent Hugo

Trent Hugo

I love building web applications that are not only functional but also enjoyable to use. Always curious, always learning.

Git for Beginners: How It Really Works

3 min readDec 28, 2025

--

If you’re new to programming or collaborating on code, you’ve probably heard of Git. But what is it, and why do so many developers swear by it? Let’s break it down in simple terms.

What is Git?

Git is a version control system. Think of it as a super-powered “undo button” for your code. It tracks changes, keeps history, and helps multiple people work on the same project without chaos.

Get Trent Hugo’s stories in your inbox

Join Medium for free to get updates from this writer.

Imagine writing a book. Without Git, you might save multiple copies: Book_v1.doc, Book_v2.doc, Book_final.doc. It’s messy. Git lets you track changes, go back to previous versions, and collaborate with others without creating dozens of copies.

Press enter or click to view image in full size
Git workflow

How Git Works

1. Repository — Your Project’s Home

A repository (or “repo”) is where Git stores all your project files and history. You can create one on your computer or on platforms like GitHub.

git init

This command initializes a new Git repository in your folder. Now Git starts tracking changes!

2. Staging Changes — Preparing for Save

When you modify files, Git doesn’t automatically save them. First, you stage them:

git add file.txt

Think of staging as putting things in a shopping cart before checkout. You choose what changes to include in the next snapshot.

3. Commit — Saving Your Progress

A commit is like taking a snapshot of your project at a point in time:

git commit -m "Add homepage layout"

This records your changes along with a message describing what you did. You can always go back to this commit later.

4. Branching — Experiment Safely

A branch is a separate line of development. Want to try a new feature without messing up the main code?

git branch new-feature
git checkout new-feature

Now you can work freely. Later, you can merge it back into the main branch.

5. Merging — Bringing Changes Together

Once your feature is ready, merge it into the main branch:

git checkout main
git merge new-feature

Git will combine your changes. If two people modified the same line, Git will ask you to resolve the conflict manually.

6. Pushing — Share with the World

To share your work with others, push your commits to a remote repository (like GitHub):

git push origin main

Now your changes are online, safe, and accessible to collaborators.

Why Git is Awesome

  • Track history: Never lose work.
  • Collaboration: Multiple people can work together seamlessly.
  • Experiment safely: Try new ideas without breaking the main project.
  • Restore anything: Go back to any previous version anytime.

Final Thoughts

Git might feel confusing at first, but remember: it’s just a tool to keep your code organized and safe. Start small: create a repository, make commits, and experiment with branches. Soon, it will feel like second nature.

💡 Pro tip: Combine Git with platforms like GitHub or GitLab to collaborate, showcase your projects, and build your portfolio.

--

--

Written by Trent Hugo

0 followers

I love building web applications that are not only functional but also enjoyable to use. Always curious, always learning.