Skip to content
5 min read

Git Basics: The Commands You Need on Day One

Learn the essential Git basics every developer needs to know. This guide covers git init, add, commit, push, pull, branches, and merge — with practical examples for beginners.

#git #tools #beginner #career

Git basics are non-negotiable for any developer. Git is the version control system used by virtually every software project in the world. It tracks changes to your code, lets you collaborate with others, and saves you when you break something. Here’s what you need to know on day one.

What Git Does

Git keeps a history of every change you make to your code. If you break something, you can go back. If you’re collaborating, multiple people can work on the same project without overwriting each other’s work.

Setting Up Git

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

The Core Workflow

# Start a new repository
git init

# Check what's changed
git status

# Stage changes for commit
git add filename.py          # one file
git add .                    # all changed files

# Save a snapshot (commit)
git commit -m "Add user login feature"

# See your commit history
git log --oneline

Think of commits like save points in a video game. Commit often, with clear messages.

Working with GitHub

# Connect your local repo to GitHub
git remote add origin https://github.com/username/repo.git

# Push your commits to GitHub
git push origin main

# Pull latest changes from GitHub
git pull origin main

# Clone an existing repository
git clone https://github.com/username/repo.git

Branching — Working on Features Safely

# Create and switch to a new branch
git checkout -b feature/user-auth

# Make your changes, then commit
git add .
git commit -m "Add JWT authentication"

# Switch back to main
git checkout main

# Merge your feature in
git merge feature/user-auth

Branches let you work on features without affecting the main codebase. Always create a branch for new features.

Conclusion

These Git basics — init, add, commit, push, pull, and branch — are enough to start contributing to real projects. Git has dozens of advanced features, but master these first. Set up GitHub and push your first project today. Every developer, regardless of experience, uses these commands daily.

Read next: Building a Portfolio That Actually Gets You Hired

External resource: Pro Git Book — Free Online

Kaikobud Sarkar

Kaikobud Sarkar

Software engineer passionate about backend technologies and continuous learning. I write about Python frameworks, cloud architecture, engineering growth, and staying current in tech.

Related Articles

CSS Flexbox in Plain English: A Beginner's Guide

Learn CSS Flexbox with simple, visual explanations. This guide covers display flex, justify-content, align-items, flex-wrap, and practical layouts every developer needs to know.

#css #flexbox