This document provides a standard initial git setup when starting a project locally and later pushing to remote repository instead of starting from a pull operation.
Quick reference
git init
git branch -M main
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO.git
git push --set-upstream origin mainOrient yourself first
pwd # confirm you are in the right directory
ls -la # list all files including hidden (e.g. existing .git)
du -sh ./* # check size of each item before committingInit and branch
git init # initialize repo in current directory
git branch -M main # rename default branch to main
git branch # confirm branch nameStage and commit
git status # see untracked files
git add . # stage everything
git status # confirm what is staged
git commit -m "Initial commit"Connect remote and push
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO.git
git remote -v # confirm remote URL
git push --set-upstream origin main # first push, sets tracking branchVerify
git branch # confirm you are on main
git status # should say "nothing to commit, working tree clean"