Connect to GitHub, push and pull changes, fetch without merging, and write commit messages and branch names that stay readable months later.
Why: a remote is just a named URL pointing at another copy of the repository, usually on GitHub.
List configured remotes
git remote -vConnect a local repo to GitHub
git remote add origin "url"Point an existing remote at a new URL
git remote set-url origin "url"Rename a remote
git remote rename "remote-branch-name" "new-remote-branch-name"Delete the link between your local git repository and remoter server specified by the branch name
git remote remove "remote-branch-name"First push of a new branch — sets up tracking
git push -u origin "branch-name"Subsequent pushes
git pushPull the latest changes (fetch + merge)
git pullPull and replay your commits on top instead of merging
git pull --rebaseWhy: git fetch downloads new commits from the remote but leaves your branches untouched, so you can inspect changes before merging.
git fetch originSee what's new on the remote before touching your branch
git log main..origin/main --onelineMerge it in once you're ready
git merge origin/main