Skip to main content

GitKit (2nd ed.): Learn git and GitHub in Context

Section 4.5 Pushing main to Your Origin

Exercises

Your local main branch is now in synch with the upstream main branch. However, the updates that you pulled into your local main branch are not yet in your origin repository. The exercises in this section will guide you through the process of getting them there.

1.

Recall that you previously used the git push <remote> <branch> command to push your feature branch from your local repo to your origin repo.
Give a git push command that will push the main branch of your local repo to your remote origin repo.

2.

Run the git push command you wrote in Exercise 4.5.1 in the Terminal and examine the output.
(a)
Examine the output from your git push command. You should see a lot of information about deltas and objects. Those are terms related to the inner workings of Git that we will not worry about.
If you don’t see information about deltas and objects but see an error message instead, revisit Exercise 4.5.1 and try again.
(b)
    The last two lines of the output should contain some recognizable information. What do you think that these lines are telling you?
  • The URL of your origin on GitHub.
  • The name of the branch that you pushed to GitHub.
  • The URL of the upstream repository on GitHub.
  • A list of all the files changed in the local repository.
  • A list of all the branches in the local repository.
Hint.
Only look at the last two lines, the one that starts with "To" and the one that starts with a SHA code.
As with most things related to Git and GitHub, there are a number of different ways to synchronize. For example, you can also fetch the changes from the upstream main to your origin and then pull them from there to your local repository. If you are curious, you can check out this GitHub link: Syncing a fork
 1 
https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/syncing-a-fork
You have attempted 1 of 3 activities on this page.