790 words
4 minutes

Your First Git Commit - A Beginner-Friendly Guide to Version Control

Cover image for Your First Git Commit - A Beginner-Friendly Guide to Version Control

Hey, tech queens! 👩‍💻✨

If you’ve ever seen the word Git and thought:

“Okay, this sounds important… but also kind of intimidating?”

You’re not alone.

But here’s the good news: Git isn’t scary — it’s an essential tool that’ll make your coding life much easier.

Let’s walk through your first Git setup and commit, step by step — no jargon, no stress.


What Is Git, Really?#

Think of your code like a project notebook. You want to:

  • save versions as you go,
  • undo mistakes,
  • and maybe work on it with other people — without chaos.

Git is the version control system that makes all of that possible.

It helps you:

  • snapshot your work at any time,
  • roll back if something breaks,
  • and collaborate smoothly with others.

Installing Git (No Stress, Just Steps)#

On macOS#

Open Terminal and run:

Terminal window
brew install git

Note: Homebrew must be installed beforehand.

If your Mac prompts you to install Xcode Command Line Tools, accept it — that’s normal.

On Windows#

Simplest method: download Git from git-scm.com. It includes Git Bash, which gives you a helpful command-line interface.

Prefer using the terminal?

Terminal window
winget install --id Git.Git

(Works on Windows 10 1809+ and Windows 11.)

On Linux#

For Debian/Ubuntu:

Terminal window
sudo apt-get install git

For Fedora:

Terminal window
sudo dnf install git

For Arch-based systems:

Terminal window
sudo pacman -S git

Check the Installation#

Make sure Git is installed with:

Terminal window
git --version

If you see a version number, you’re all set.


Configure Git (Just Once)#

Git tags your work with your name and email so you can track who made which changes — even if it’s just you.

Terminal window
git config --global user.name "Your Name"
git config --global user.email "[email protected]"

Set main as the default branch name (instead of the older master):

Terminal window
git config --global init.defaultBranch main

Optional: avoid using Vim by default (it can be confusing for beginners). Use something simpler like nano:

Terminal window
git config --global core.editor "nano"

Prefer VS Code? Use:

Terminal window
git config --global core.editor "code --wait"

Creating Your First Repository#

Create a new folder for your project and initialize Git inside it:

Terminal window
mkdir my-first-repo && cd my-first-repo
git init

You now have a Git repository — a versioned folder ready to track changes.


Add a File and Make Your First Commit#

Let’s create a basic file:

Terminal window
echo "Hello, Git!" > README.md

Note: File names like README.md and readme.md are treated the same on macOS and Windows, but they’re different on Linux — case matters.

Check Git’s status:

Terminal window
git status

It will show the new file but mark it as untracked.

Tell Git to track it:

Terminal window
git add README.md

Now make your first commit:

Terminal window
git commit -m "Add README"

Done — your first snapshot is saved in Git history!


Bonus: Use .gitignore to Keep Things Clean#

You might have folders or files you don’t want to track — like node_modules, log files, or build output.

Create a .gitignore file:

Terminal window
echo "node_modules/" > .gitignore

Want help generating one for your tech stack? Check out gitignore.io.


Optional (But Handy) - Windows Line Ending Fix#

If you’re on Windows and see warnings like “LF will be replaced by CRLF,” run:

Terminal window
git config --global core.autocrlf true

This helps avoid annoying line ending issues between systems.


Make Things Faster with Aliases#

Tired of typing full commands? Set up aliases:

Terminal window
git config --global alias.st status
git config --global alias.co checkout
git config --global alias.br branch

Now you can use git st instead of git status. Shortcuts = efficiency.


Prefer GUIs Over Command Line?#

If the terminal isn’t your thing (yet), try a visual interface:

You can always switch to the terminal when you feel ready.


Quick Cheat Sheet#

CommandDescription
git initCreates a Git repo
git statusShows changes and file states
git addStages files for commit
git commit -m ""Saves a snapshot with a message
git configSets global Git settings (name, editor, etc.)

You Did It#

You installed Git, configured it, created a repo, and made your first commit.

That’s a big step in your dev journey — version control is a core skill for any developer.

Now you’ve got the tools and confidence to take control of your projects.


Tools I Personally Trust#

If you want to make your digital life a little calmer - here are two tools I use every day:

🛸 Proton VPN - A trusted VPN that secures your Wi-Fi, hides your IP, and blocks trackers. Even in that no-password café Wi-Fi, you’re safe.

🔑 Proton Pass - A password manager with on-device encryption. Passwords, logins, 2FA - always with you, and only for you.

These are partner links - you won’t pay a cent more, but you’ll be supporting DevOps.Pink. Thank you - it really means a lot 💖


Social Channels#

🎬 YouTube
🐦 X (Twitter)
🎨 Instagram
🐘 Mastodon
🧵 Threads
🎸 Facebook
🦋 Bluesky
🎥 TikTok
💻 LinkedIn
📣 daily.dev Squad
✈️ Telegram
🐈 GitHub


Community of IT Experts#

👾 Discord


Refill My Coffee Supplies#

💖 PayPal
🏆 Patreon
🥤 BuyMeaCoffee
🍪 Ko-fi
Telegram Boost


Is this content AI-generated?

Absolutely not! Every article is written by me, driven by a genuine passion for Docker and backed by decades of experience in IT. I do use AI tools to polish grammar and enhance clarity, but the ideas, strategies, and technical insights are entirely my own. While this might occasionally trigger AI detection tools, rest assured—the knowledge and experience behind the content are 100% real and personal.

Your First Git Commit - A Beginner-Friendly Guide to Version Control
https://www.devops.pink/first-git-commit-a-beginner-friendly-guide-to-version-control/
Author
Tatiana Mikhaleva
Published at
2025-05-12
License
CC BY-NC-SA 4.0