Git Sticky Notes - johnverz22/webdev1-lessons GitHub Wiki

Repository Setup

  1. Initialize Git Repository
    git init
  2. Link to Remote GitHub Repository
    git remote add origin <repo-URL>
  3. Set Up Local Configuration
    (Run once per repo if global config is already set)
    git config user.name "Your Name"
    git config user.email "[email protected]"
  4. (Optional) Logout of GitHub on shared computers
    (If another account is currently logged in, run the following to logout)
    git credential-cache exit

During Development

  1. Check Status
    (See current changes)

    git status
  2. Stage Changes
    (Prepare to save all changes)

    git add .
  3. Commit Changes
    (Save prepared changes locally, providing a message or description)

    git commit -m "Your meaningful message"
  4. Push to GitHub
    (Send commits to remote repo to update it)

    git push origin <branch-name>

    Default branch is usually main.


Tips

  • Commit Often: Small commits make it easier to track changes.
  • Meaningful Messages: Always describe what was changed or fixed.
  • Pull Before Push: Stay updated with remote changes.
    git pull --rebase origin main

Keep this handy for smooth Git workflows! 🚀

Avoid Commit - Push - Add or else:

Git Meme

⚠️ **GitHub.com Fallback** ⚠️