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 (2)

Collapse
 
devops_fundamental profile image
DevOps Fundamental

Insightful and well-written as always!

Collapse
 
sandaruwan_wadiyage profile image
Sandaruwan Wadiyage

Thank you for your kindest response!