GitHub

Setting up GitHub for version control and creating backup points

Why Use GitHub?

This is where you'll save your work online and create backup points you can return to later.

Setting Up Your Repository

Step 1: Create Repository

  1. Go to github.com and log in or sign up
  2. Click the green New button under "Repositories"
  3. Name your app, set it to Private, and click Create repository

Step 2: Connect Your Local Project

You'll see some code after creating the repository. Copy it and paste it into your terminal in Cursor:

echo "# example" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/Must-be-Ash/example.git
git push -u origin main

This will create a connection between your 'local' folder and your online website (your 'remote' folder which is used in 'production').

Saving Your Progress

Making Your First Push

After setting up the connection, make your first 'push' (a.k.a publishing what you have on your computer online) by pasting this into your terminal:

git add .
git commit -m "First commit"
git push origin main

Regular Commits

Use these lines to continuously save yourself a checkpoint which you could always go back to:

For regular updates:

git add .
git commit -m "updated blah blah"
git push origin main

For stable versions:

git add .
git commit -m "Last Working Version"
git push origin main

Leaving comments like above will help you track the version and flag checkpoints to yourself.

Best Practices

When to Commit

  • After each feature: When you add something new that works
  • Before major changes: Create a checkpoint before attempting big modifications
  • At the end of each session: Save your progress before closing your IDE
  • When everything works: Mark stable versions clearly

Commit Message Tips

✅ Good examples:

  • "Add user authentication with Clerk"
  • "Fix mobile navigation styling"
  • "Working version before API integration"

❌ Avoid:

  • "stuff"
  • "fix"
  • "idk"

Understanding the Terms

Local vs Remote

  • Local: The file copy of your code on your computer
  • Remote: The copy of your code on GitHub

Development vs Production

  • Development: Your site running locally (http://localhost:3000/)
  • Production: Your live site on the internet (https://website.com/)

Common Commands

  • git add . - Stage all changes for commit
  • git commit -m "message" - Save changes with a message
  • git push origin main - Upload changes to GitHub