A picture is worth a thousand words! The Animated Git series continues. The series introduces core Git concepts with pictures and animations.

If you missed it, watch and read:

This third part introduces the master and origin/master branches and how to push local changes to the remote repository.

Understand the default names

Git automatically creates :

  • origin, the default name of the remote repository when you ran git clone in part 2
  • master, the default name of the starting branch when you initialize a repo (you’ll learn more in part 4 why it is called a “branch”)

Initially, you’ll have two pointers to two different states of your project:

  • master
  • origin/master

Track the project versions

In one hand, origin/master tracks the latest version synchronized with the remote repository:

In the other hand, as you commit your local changes (read Part 1 on creating commits), master moves automatically to the latest commit:

Share your work

You push your local commits to synchronize the remote repository with your local changes. In part 4, you’ll learn how to synchronize the other way, from the remote repo to the local one.

The following command pushes your changes on master to the corresponding branch on the remote repository origin:

$ git push origin master

Similarly to master, the origin/master branch moves automatically to the latest synchronized version:

We recommend the following articles to learn more about syncing and pushing your work:

The Animated Git series will continue soon. Follow us on @WakandaSoft to catch the next one!