Connecting to a new GitHub repo
- Create a new repo on Github (do not make readme, .gitignore or licence files)
git remote add origin <remote_url>- Verify the remote URL:
git remote add origin <remote_url> - Push:
git remote add origin <remote_url>
Change remote origin URL
- Create a new repo on Github (do not make readme, .gitignore or licence files)
git remote set-url origin <remote_url>- Verify the remote URL:
git remote -v - Make any changes
- Push:
git push -u origin main
Rename Git master branch to main
git branch -m master maingit push -u origin main
Changes
Commit and push a change for the first time
git add .git commit -m "fix: add missing brackets"git push -u origin <branch_name>(this connects the local branch to the remote branch)
Commit and push a change
git add .git commit -m "fix: add missing brackets"git push
Undo a commit
git reset --soft HEAD~1
