Push and Pull

View saved

Push your branch

Pushing uploads commits GitHub does not have yet. The -u flag sets the upstream tracking branch the first time.

git push -u origin main
git push

Pull remote updates

Pulling fetches new commits from the remote and integrates them into your current branch. Run it before you start new work on a shared branch.

git pull

See what changed remotely

Fetch downloads updates without merging so you can inspect them first.

git fetch origin
git log --oneline HEAD..origin/main

Handle a rejected push

If someone else pushed first, pull (or rebase, later in your learning), resolve any conflicts, then push again. Do not force-push shared branches unless your team has an explicit rule.

Comments

One comment per signed-in account. Comments are saved with this page’s URL.