DEV Community

Cover image for 🧠 Git & GitHub: Version Control for Beginners
sagardoescoding
sagardoescoding

Posted on

🧠 Git & GitHub: Version Control for Beginners

🧠 Git & GitHub: Version Control for Beginners
πŸ“… Posted on Jun 29
✍️ By @sagardoescoding

During my internship with @devsync, one of the most powerful tools I got comfortable with was Git β€” and how it works with GitHub for version control and collaboration.

If you're a beginner developer, mastering Git & GitHub is an absolute must-have skill. Let’s break it down super simple.

πŸ’‘ Why Git & GitHub?
βœ… Track every change in your codebase
βœ… Collaborate easily with teams
βœ… Roll back to previous versions anytime
βœ… Showcase your work to the world (hello, recruiters!)

πŸ”§ Git vs GitHub
Git: A version control system you install on your machine. Think of it as a β€œtime machine” for your code.

GitHub: An online platform that hosts your Git repositories, adds collaboration tools, and lets you work with others.

πŸ› οΈ Git Basics Every Dev Should Know
βœ… 1. Initialize a Git Repo

git init
βœ… 2. Check Repo Status

git status

βœ… 3. Add Files to Stage

csharp
git add .
βœ… 4. Commit Changes

sql

git commit -m "Your commit message"
βœ… 5. Connect to GitHub

git remote add origin https://github.com/username/repo.git

βœ… 6. Push Code

git push -u origin main
🌱 Common Git Commands
Command Purpose
git clone Copy a remote repo to your machine
git pull Fetch latest changes from remote
git log View commit history
git branch Manage branches
git merge Merge one branch into another

πŸ”„ Example Workflow

git init

git add .

git commit -m "Initial commit"

git branch -M main

git remote add origin https://github.com/yourusername/yourrepo.git

git push -u origin main
βš™οΈ Pro Tips
Use .gitignore to exclude files like node_modules, .env, etc.

Write clear commit messages:
βœ–οΈ "stuff fixed"
βœ… "Fix bug in login validation logic"

πŸ§ͺ Tools That Help
GitHub Desktop – GUI for Git (great for beginners)

GitLens Extension for VS Code – Superpowers for Git

GitKraken – Advanced Git UI

πŸ‘‹ Final Thoughts
If you're coding without Git β€” you're flying without a parachute.
Even solo projects benefit from version control and backups.

This is just the start of my Git journey, but it's already made my workflow smoother and more professional.

Top comments (0)