Learn Version Control with Git

A step-by-step course for the complete beginner

Learn Version Control with Git featured image

Publishing a Local Branch

A local branch that you create on your machine is kept private to you until you explicitly decide to publish it. This means that it's perfectly possible to keep some of your work private while sharing only certain other branches with the world.

Let's share our "contact-form" branch (which hasn't been published until now) on the remote.

To do so, either drag the local branch and drop it onto the remote item where you want to publish it - or right-click it and choose "Publish <branch name>...".

To do so, simply right-click it and choose "Publish <branch name>...".

In most cases, the following things make sense when you publish a branch:

  • (a) Establish a tracking connection between the branches by ticking the "Track" option.
  • (b) Keep the names between local branches and their remote counterparts the same.

After having created that new remote branch like this, updating it with new local commits that you create in the future is easy: simply click the "Push" button in the toolbar!

Anyone with access to your remote repository can now also start working on "contact-form": he can create a local branch on his machine that tracks this remote branch and also push changes to it.

About Us

As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.

Just like with Tower, our mission with this platform is to help people become better professionals.

That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.