Git & GitHub for Beginners: Stop Copy-Pasting Code Files!
⚠️ If you're still emailing yourself code files, you need Git. Here's why and how to use it.
What is Git? (In Plain English)
Git is a version control system that tracks changes to your code. Think of it as "Google Docs history" for your code files.
📁 Without Git: project_v1.zip, project_v2.zip, project_final.zip, project_REAL_FINAL.zip
🐙 With Git: One folder, Git tracks all changes automatically
🐙 With Git: One folder, Git tracks all changes automatically
Essential Git Commands (The 8 You Need)
| Command | What It Does | When to Use |
|---|---|---|
git init |
Start tracking a folder | Beginning a new project |
git add . |
Stage all changes | After writing code |
git commit -m "message" |
Save changes with message | When you complete a feature |
git status |
See what's changed | Anytime (your most used command) |
git log |
See commit history | To see what you've done |
git push |
Upload to GitHub | When ready to share/backup |
git clone [url] |
Download a repository | To get someone else's code |
git pull |
Download updates | When collaborating |
Complete Workflow Example
1
Initialize & First Commit
# Create project folder
mkdir my-project
cd my-project
# Initialize Git
git init
# Create your first file
echo "# My Awesome Project" > README.md
# Add and commit
git add .
git commit -m "Initial commit: Add README"
2
Connect to GitHub
# Create new repo on GitHub.com
# Then connect local to remote
git remote add origin https://github.com/username/repo.git
git branch -M main
git push -u origin main
3
Daily Workflow
# 1. Make changes to your code
# 2. Check what changed
git status
# 3. Add changes
git add .
# 4. Commit with descriptive message
git commit -m "Add user login feature"
# 5. Push to GitHub
git push
💡 Pro Tips for Beginners
- Commit often: Small, frequent commits are better than one huge commit
- Write good messages: "Fix bug" ❌ vs "Fix login button not working on mobile" ✅
- Use .gitignore: Don't track node_modules, .env files, or IDE settings
- Branch for features: Use
git checkout -b feature-namefor new features
🌐 Your GitHub Profile = Your Developer Resume
Start pushing your projects to GitHub today. Employers look at GitHub profiles more than resumes!
View My GitHub Profile Example
Comments
Post a Comment