DEV Community

Cover image for What is Git? A Beginner's Guide with Real Examples
Raaga Priya Madhan
Raaga Priya Madhan

Posted on

What is Git? A Beginner's Guide with Real Examples

Every developer talks about Git. But if you're just starting out, it can feel overwhelming. Let me break it down simply.

What is Git?

Git is a tool that tracks changes to your code over time.

Think of it like a save system in a video game. Every time you hit save, Git remembers exactly what your code looked like at that moment. If you break something later, you can go back to any previous save.

Why do developers use it?

Without Git, if you accidentally delete important code — it's gone forever. With Git, you just roll back to the last working version.

It also lets multiple developers work on the same project without overwriting each other's work.

The 5 commands you actually need

1. git init

Starts tracking a folder with Git.

git init
Enter fullscreen mode Exit fullscreen mode

2. git add

Tells Git which files to save.

git add filename.py
Enter fullscreen mode Exit fullscreen mode

3. git commit

Actually saves the snapshot with a message.

git commit -m "Added data cleaning function"
Enter fullscreen mode Exit fullscreen mode

4. git push

Uploads your code to GitHub so others can see it.

git push
Enter fullscreen mode Exit fullscreen mode

5. git clone

Downloads someone else's project to your computer.

git clone https://github.com/username/repo
Enter fullscreen mode Exit fullscreen mode

GitHub vs Git

Git is the tool. GitHub is the website where you store your Git projects online — like Google Drive but for code.

The one-line summary

Git saves snapshots of your code so you never lose work and can always go back in time.

Start using it on your next project and it'll become second nature within a week.


Written by Raaga Priya Madhan — CSE student, Bangalore. I write about CS concepts simply. Connect with me on LinkedIn

Top comments (0)