DEV Community

Sandaruwan Wadiyage
Sandaruwan Wadiyage

Posted on

HOW TO UPLOAD YOUR PROJECT TO GITHUB – STEP-BY-STEP WITH CHEAT SHEET 🧩

πŸ“Œ INTRODUCTION

Uploading your project to GitHub for the first time?

Here’s a clean, beginner-friendly walkthrough β€” plus a downloadable cheat sheet to keep handy.

🧠 STEP-BY-STEP GIT COMMANDS EXPLAINED

πŸ”Ή Step 1: Initialize Git
git init - This creates a .git folder in your directory and enables version tracking.
πŸ”Ή Step 2: Stage All Files
git add . - This stages all your changes for commit.
πŸ”Ή Step 3: Commit with a Message
git commit -m "Initial commit"
πŸ”Ή Step 4: Connect Remote Repository
git remote add origin https://github.com/your-username/your-repo.git
Tip: Already connected to another remote?
git remote set-url origin <new-link>
πŸ”Ή Step 5: Push to GitHub
git branch -M main
git push -u origin main
-u links to your local branch to remote branch.

πŸ” AFTER MAKING CHANGES

git status
git add .
git commit -m "Updated section UI"
git push origin main

🧹 OPTIONAL: DELETE β€˜MASTER’ BRANCH

git push origin --delete master
βœ” Confirm:

  • main has latest updates
  • GitHub default is main
  • No one using master

πŸ“Ž CHEAT SHEET

Here’s a visual version to download and share πŸ‘‡

πŸ”š FINAL THOUGHTS

If you're a beginner or just want to keep things simple, this is all you need to get your project onto GitHub.
Have any tips or favorite commands? Share them in the comments!

Image description

Top comments (0)