Git and GitHubLesson 24Free preview
Push to GitHub
This lesson is part of Git · All levels
Summary
Git sends a local commit to GitHub remote so that the team can access it. For the first push of a branch, use the -u option to connect the local branch to the remote (upstream). If the remote has a commit you don't yet have, it'll be rejected and you need to pull first.
Key points
- Git -u origin main sends branches and sets upstream
- The -u/--set-upstream option makes the next push enough with the git push
- Reject when the remote comes first; run the git pull --rebase and then again
- Git origin --tags send all the tags to the remote
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.