A "Git & GitHub for Beginners – 1-Hour Crash Course in 6 Minutes Flat" refers to a condensed tutorial designed to quickly introduce the fundamental concepts and practical usage of Git and GitHub to beginners. The goal is to deliver the essential information and actionable steps from a longer, more comprehensive crash course in a highly time-efficient manner.

Key concepts typically covered in such a condensed course include:

  • What is Git? 

    Explaining Git as a distributed version control system for tracking changes in code and facilitating collaboration.

  • What is GitHub? 

    Introducing GitHub as a web-based platform for hosting Git repositories, enabling sharing, collaboration, and project management.

  • Basic Git Workflow: 

    Understanding the cycle of making changes, staging them, committing them, and pushing them to a remote repository.

  • Essential Git Commands:

    • git init: Initializing a new Git repository.
    • git add: Staging changes for the next commit.
    • git commit: Saving staged changes with a descriptive message.
    • git push: Uploading local commits to a remote repository (e.g., on GitHub).
    • git pull: Downloading changes from a remote repository to the local machine.
    • git clone: Copying an existing remote repository to a local machine.
  • Connecting to GitHub: 

    Setting up a remote repository on GitHub and linking it to a local Git repository.

  • Collaboration basics: 

    Briefly touching on how multiple developers can work on the same project using Git and GitHub.

 

1. Install & First-Time Setup

bash

# Download: https://git-scm.com/downloads
git --version

git config --global user.name "Your Name"
git config --global user.email "you@email.com"
git config --global init.defaultBranch main

2. Create Your First Repo (Local)

bash

mkdir my-project
cd my-project
git init                  # creates .git folder
touch index.html
git status                # red = untracked
git add index.html        # stage it (turns green)
git add .                 # stage EVERYTHING
git status                # now green
git commit -m "First commit 🎉"

3. The Holy Trinity (You’ll use these 1000x)

bash

git status          # what’s going on?
git add .           # stage all changes
git commit -m "msg" # save snapshot

4. Undo Anything (Save Your Life)

bash

git log             # see all commits
git checkout filename    # undo changes to a file
git reset --hard HEAD    # DANGER: erase all uncommitted changes
git revert <commit-hash> # safe undo (creates new commit)

5. Connect to GitHub (Remote)

bash

# On GitHub.com → New repository → NO README
# Copy the URL

git remote add origin https://github.com/username/repo.git
git branch -M main
git push -u origin main

Refresh GitHub → your code is live! 🚀


6. The Daily Workflow (Clone → Work → Push)

bash

# Day 2 on a new machine
git clone https://github.com/username/repo.git
cd repo
# edit files...
git add .
git commit -m "Update styles"
git push                  # because of -u earlier

7. Pull Requests & Collaboration

bash

# You forked someone’s repo
git clone https://github.com/YOUR-USERNAME/forked-repo.git
# make changes
git add . && git commit -m "Fix typo"
git push origin main

# Go to GitHub → “Compare & pull request” → Create PR

8. Branches = Parallel Universes

bash

git branch feature-login
git checkout feature-login
# or shorter:
git checkout -b feature-login

# work work work
git add . && git commit -m "Add login page"

git push origin feature-login
# → create PR on GitHub

Merge on GitHub → delete branch → done.


9. Sync Fork (Stay Up-to-Date)

bash

# Add original repo as upstream
git remote add upstream https://github.com/original/repo.git

# Every morning
git checkout main
git pull upstream main
git push origin main

10. .gitignore – Never Commit These

Create .gitignore file:

text

node_modules/
.env
*.log
.DS_Store
dist/

Bonus: Top 10 Commands You’ll Type Daily

bash

1. git status
2. git add .
3. git commit -m "fix: bug"
4. git push
5. git pull
6. git log --oneline
7. git checkout -b new-feature
8. git branch -d old-branch
9. git stash           # hide changes temporarily
10. git stash pop     # bring them back