🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
🪟 Windows TippsCannot find OS partitions for disk 0 MBR2GPT Conversion failed(14.09.2026 um 00:14 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenVorsicht: Android-Malware verschlüsselt Ihre Handys und nimmt heimlich Fotos auf(13.09.2026 um 09:30 Uhr)
🕵️ SicherheitslückenMicrosoft-Patchday: 966 Schwachstellen, davon 105 kritisch - BornCity(13.09.2026 um 06:31 Uhr)
🤖 Android TippsSamsung-Handys verlieren bald eine praktische App(14.09.2026 um 05:07 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🔧 AI Nachrichten ChatGPT automatically logged out [Fix](12.09.2026 um 17:09 Uhr)
🪟 Windows TippsCannot find OS partitions for disk 0 MBR2GPT Conversion failed(14.09.2026 um 00:14 Uhr)
⚠️ Malware / Trojaner / VirenWindows 11 just dropped the tool ransomware abused, Microsoft says don’t restore WMIC(10.09.2026 um 20:11 Uhr)
⚠️ Malware / Trojaner / VirenVorsicht: Android-Malware verschlüsselt Ihre Handys und nimmt heimlich Fotos auf(13.09.2026 um 09:30 Uhr)
🕵️ SicherheitslückenMicrosoft-Patchday: 966 Schwachstellen, davon 105 kritisch - BornCity(13.09.2026 um 06:31 Uhr)
🤖 Android TippsSamsung-Handys verlieren bald eine praktische App(14.09.2026 um 05:07 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 17 Min Lesezeit
0

Git Crash Course: From Absolute Beginner to Confident User

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

A complete, hands-on guide to version control that actually makes sense









Before We Begin: Why Git Matters



I'll never forget my first week as a junior developer. I'd been working on a feature for three days when my computer crashed. The file corrupted. Three days of work, gone forever. I literally cried at my desk.



My senior dev walked over, looked at my screen, and said something I'll never forget: "You didn't use Git?"



That night, I learned Git. I've never lost work since.



Git is a time machine for your code. It lets you:




  • Travel back to any previous version of your project

  • Work on multiple features simultaneously without them interfering

  • Collaborate with others without accidentally overwriting their work

  • Experiment freely, knowing you can always undo



This tutorial will take you from "Git? Isn't that a type of fruit?" to confidently using Git in your daily workflow.



What you'll learn:




  • Core concepts explained simply

  • Step-by-step commands with real examples

  • Daily workflows you'll actually use

  • How to fix mistakes (because you will make them)



Prerequisites:




  • A computer (Mac, Windows, or Linux)

  • Ability to open a terminal/command prompt

  • A text editor



Time to complete: About 1-2 hours



Let's start your Git journey.









Part 1: What Is Version Control? (The Mental Model)






The Problem Git Solves



Imagine you're writing an essay. You might do this:




CODE
essay_final.docx
essay_final2.docx
essay_final_really_final.docx
essay_final_OMG_this_time_for_real.docx






We've all been there. This is manual version control, and it's terrible.



Git solves this by tracking every change automatically. Think of it as:





  • A snapshot machine — Every time you save, Git takes a picture of your entire project


  • A time machine — You can go back to any snapshot


  • A parallel universe generator — Create alternate timelines to try ideas safely






The Three States of Git



Everything in Git exists in one of three states:




CODE
Working Directory → Staging Area → Repository
(your files) (ready to save) (saved forever)






Think of it like preparing a photo album:





  1. Working Directory — You take photos (make changes to files)


  2. Staging Area — You select which photos to put in the album (choose what to save)


  3. Repository — You paste them in the album permanently (commit)



Let's see this in action.









Part 2: Installing and Configuring Git






Step 1: Install Git



Mac:




CODE
# Using Homebrew (recommended)
brew install git

# Or download from git-scm.com






Windows:

Download from and sign in

  • Click the "+" icon → "New repository"

  • Name it "my-first-git-project"

  • Don't initialize with README (we already have one)

  • Click "Create repository"






  • Step 2: Connect Your Local Repo to GitHub



    GitHub will show you commands. Run:




    CODE
    git remote add origin https://github.com/YOUR-USERNAME/my-first-git-project.git






    This tells Git: "There's a remote repository called 'origin' at this URL."






    Step 3: Push Your Code to GitHub






    CODE
    git push -u origin main






    The -u sets up tracking so future pushes can just use git push.






    Step 4: Check GitHub



    Refresh your GitHub page. Your code is now online!






    Step 5: Pull Changes from GitHub



    If someone else pushes changes, or you work on another computer:




    CODE
    git pull origin main






    This downloads and merges changes from GitHub.









    Part 11: The Daily Developer Workflow



    Here's what your actual day-to-day workflow looks like:






    Morning: Start Fresh






    CODE
    git checkout main
    git pull origin main









    Work on a New Feature






    CODE
    git checkout -b feature/awesome-thing
    # Write code...
    git add .
    git commit -m "Add awesome feature part 1"
    # Write more code...
    git add .
    git commit -m "Finish awesome feature"









    Update Your Branch with Latest Changes






    CODE
    git checkout main
    git pull origin main
    git checkout feature/awesome-thing
    git merge main
    # Fix any conflicts









    Push and Create Pull Request






    CODE
    git push origin feature/awesome-thing






    Then on GitHub, create a Pull Request for your feature.









    Part 12: Handy Shortcuts and Aliases



    Git has many shortcuts that save time:






    Staging Shortcuts






    CODE
    # Stage all changes (including new files)
    git add -A

    # Stage all changes in current directory
    git add .

    # Interactive staging (choose what to stage)
    git add -p









    Commit Shortcuts






    CODE
    # Amend last commit (if you forgot something small)
    git commit --amend

    # Commit with a shorter message flag
    git commit -m "Message"









    Log Shortcuts






    CODE
    # One-line log
    git log --oneline

    # Graph view
    git log --graph --oneline --all

    # Last 3 commits
    git log -3

    # Search commits by message
    git log --grep="bug fix"









    Create Aliases (Even Shorter!)






    CODE
    git config --global alias.co checkout
    git config --global alias.br branch
    git config --global alias.st status
    git config --global alias.hist "log --oneline --graph --all"






    Now you can use:




    CODE
    git st        # Instead of git status
    git co main # Instead of git checkout main
    git hist # Pretty history view












    Part 13: The .gitignore File – What Not to Save



    Some files should NEVER be in Git:




    • Passwords and secrets

    • Environment variables

    • Build outputs (like node_modules)

    • Temporary files

    • IDE settings






    Step 1: Create .gitignore






    CODE
    touch .gitignore









    Step 2: Add Patterns to Ignore



    Edit .gitignore:




    CODE
    # Dependencies
    node_modules/
    vendor/

    # Build outputs
    dist/
    build/
    *.exe
    *.dll

    # Environment files
    .env
    .env.local

    # IDE files
    .vscode/
    .idea/
    *.swp

    # OS files
    .DS_Store
    Thumbs.db

    # Logs
    *.log
    npm-debug.log*









    Step 3: Add and Commit






    CODE
    git add .gitignore
    git commit -m "Add .gitignore"






    Git will now ignore all those files automatically.









    Part 14: Fixing Common Mistakes






    Mistake 1: Committed to the Wrong Branch






    CODE
    # You committed to main but meant to commit to feature
    git checkout -b feature-branch # Creates branch at current commit
    git checkout main
    git reset --hard HEAD~1 # Remove commit from main









    Mistake 2: Need to Undo a Merge






    CODE
    # If you haven't pushed yet
    git reset --hard ORIG_HEAD

    # ORIG_HEAD is Git's backup of where you were before the merge









    Mistake 3: Committed with Wrong Message






    CODE
    git commit --amend -m "Correct message"









    Mistake 4: Accidentally Deleted a File






    CODE
    # Restore a deleted file from the last commit
    git restore deleted-file.txt

    # Or from a specific commit
    git restore --source=abc1234 deleted-file.txt









    Mistake 5: Need to See What Changed in a Commit






    CODE
    git show abc1234












    Part 15: A Complete Real-World Example



    Let's walk through a realistic feature development cycle:




    CODE
    # Start fresh
    git checkout main
    git pull origin main

    # Create feature branch
    git checkout -b feature/user-authentication

    # Create new files
    mkdir -p src/components
    touch src/components/LoginForm.js
    touch src/components/RegisterForm.js

    # Stage and commit
    git add src/components/LoginForm.js
    git commit -m "Add login form component"

    git add src/components/RegisterForm.js
    git commit -m "Add registration form component"

    # Oops, forgot to add styles
    touch src/components/LoginForm.css
    git add src/components/LoginForm.css
    git commit --amend --no-edit # Add to previous commit

    # Meanwhile, main has been updated. Get those changes.
    git checkout main
    git pull origin main
    git checkout feature/user-authentication
    git merge main

    # Fix any conflicts, then continue
    # Add authentication logic
    touch src/utils/auth.js
    git add src/utils/auth.js
    git commit -m "Add authentication utility functions"

    # Push and create pull request
    git push origin feature/user-authentication












    Part 16: Git Cheat Sheet (Keep This Handy)






    Getting Started






    CODE
    git init                    # Create new repo
    git clone <url> # Copy existing repo
    git config --global user.name "Name" # Set identity









    Daily Work






    CODE
    git status                  # What's happening?
    git add <file> # Stage file
    git add . # Stage all
    git commit -m "message" # Commit staged
    git commit -a -m "message" # Stage+commit tracked files
    git pull # Get latest changes
    git push # Send your changes









    Branches






    CODE
    git branch                  # List branches
    git branch <name> # Create branch
    git checkout <name> # Switch branch
    git checkout -b <name> # Create and switch
    git merge <name> # Merge branch into current
    git branch -d <name> # Delete branch









    History and Diff






    CODE
    git log                     # Show history
    git log --oneline # Compact history
    git diff # Show unstaged changes
    git diff --staged # Show staged changes
    git show <commit> # Show commit details









    Undoing






    CODE
    git restore <file>          # Discard changes
    git restore --staged <file> # Unstage
    git reset --soft HEAD~1 # Undo commit, keep changes
    git reset --hard HEAD~1 # Undo commit, discard changes
    git revert <commit> # Create undo commit









    Remote






    CODE
    git remote -v               # Show remotes
    git remote add origin <url> # Add remote
    git push -u origin main # First push
    git pull origin main # Get changes












    What You've Learned



    Congratulations! You now know enough Git to be productive. Let's review:






    Core Concepts




    • [ ] Git tracks snapshots, not differences

    • [ ] Three states: Working → Staged → Committed

    • [ ] Commits are permanent snapshots with messages






    Essential Commands




    • [ ] git init — Create repository

    • [ ] git add — Stage changes

    • [ ] git commit — Save permanently

    • [ ] git status — Check what's happening

    • [ ] git log — View history

    • [ ] git diff — See changes






    Branching




    • [ ] Branches are parallel universes

    • [ ] git branch to create/ list

    • [ ] git checkout to switch

    • [ ] git merge to combine






    Collaboration




    • [ ] git push to share

    • [ ] git pull to get updates

    • [ ] git clone to copy a repo






    Safety




    • [ ] How to undo mistakes

    • [ ] How to resolve conflicts

    • [ ] When to use .gitignore









    Next Steps



    You've mastered the basics. Here's what to learn next:





    1. Interactive Rebase — Clean up commit history before sharing


    2. Cherry-picking — Apply specific commits to other branches


    3. Stashing — Temporarily save uncommitted work


    4. Git Hooks — Automate tasks with scripts


    5. Git Flow — A branching strategy for teams


    6. Forking Workflow — Contributing to open source









    Resources




    • — When things go wrong


    • — Free courses









    Final Words of Wisdom



    From someone who's used Git for over a decade:



    You will make mistakes. Everyone does. The beauty of Git is that almost nothing is permanent. There's almost always a way to recover.



    Commit often. A commit is a save point. Save early, save often. I commit every time I complete a small logical piece of work.



    Write good commit messages. Future you will thank present you. A good message explains why, not just what.



    Branch freely. Branches are cheap and easy. Create them for everything—features, bug fixes, experiments.



    Pull before you push. Always get the latest changes before pushing your own. It avoids conflicts.



    Git is a tool, not a religion. Use what works for you and your team. The "right" way is whatever keeps your code safe and your team happy.






    That junior developer who cried over lost code? That was me. I've never lost code since learning Git. Now you won't either.



    Enjoyed this tutorial? I'm **Alexander Merveille* from Marvelbiz Solutions, a Senior Software Engineer and 1-on-1 private Instructor. I write about development tools and workflows every Month. Follow me on X . And if you have a Git horror story, we've all been there!*

    Vollständiger Original-Bericht
    Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
    ↗ Original-Artikel auf dev.to lesen
    Wie bewertest du diesen Beitrag?
    1 Klick Feedback
    Teilen mit Netzwerk & Team:

    Community-Analysen & Experten-Meinungen 0

    Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
    Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
    Community Pulse: Relevanz-Einschätzung
    1 Klick Experten-Votum
    🔴 Akute Relevanz 0%
    🟡 In Evaluierung 0%
    🟢 Keine Auswirkung 0%
    Spannende Innovation 0%
    Verwandte Story-Cluster & Quellen (Vektor-KI)
    Port 8095 Engine
    1 Quelle
    The Gemini desktop app is now available for Windows
    1 Quelle
    ChatGPT automatically logged out [Fix]
    1 Quelle
    Cannot find OS partitions for disk 0 MBR2GPT Conversion failed
    Ähnliche Beiträge
    🔍 Verwandte News

    Auch interessante Nachrichten Git Crash Course: From Absolute Beginner to Confident User

    Thematisch verwandte Begriffe: Crash, Course, From, Absolute · 6 Treffer

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...

    Laden...

    Beiträge werden geladen ...

    Laden...

    Videos werden geladen ...