Remotes — push and pull
A remote is another Git repo, usually on a server. `push` uploads your commits, `pull` downloads theirs. `origin` is the conventional name of the main remote.
A remote is just a copy of your repo somewhere else — usually GitHub, GitLab, or a server. By default, when you git clone, Git names that remote origin.
Two operations matter:
git push— upload your local commits to the remote.git pull— download new commits from the remote and merge them into your branch.
First push of a new branch needs to set up tracking: git push -u origin feature/login. The -u (or --set-upstream) tells Git 'remember this — feature/login here pairs with feature/login on origin'. Subsequent pushes are just git push.
git pull = git fetch + git merge. fetch downloads commits but doesn't touch your branch. merge then integrates them. If you prefer rebase: git pull --rebase (or set it as default with git config --global pull.rebase true).
When push fails with 'rejected — non-fast-forward' it means the remote has commits you don't. Don't force-push immediately — first git pull (or pull --rebase), resolve any conflicts, then push.
Practice
First push of branch `feature/login` to `origin`, with tracking set up.
Practice
Delete the remote branch `feature/old` from `origin`.
Practice
Complete the safe force-push command:
git push origin feature/cleanup
Grounded on https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes
Next up
Pull Requests on GitHub
A PR is a proposal to merge your branch into another. GitHub shows the diff, runs CI, and lets reviewers comment line-by-line before approving.