Create and push a branch to the remote repository (Git)

When you start on a new feature, you may want to create a branch. Branching offers a way to work on a line of code without affecting the main codebase. 

  1. From Sourcetree, click the Branch button.
  2. From the New Branch field, enter a name for your branch.
  3. Click Create Branch.
  4. You're now on your new branch. Make any updates to the repository that you want to make to your branch.
  5. Open the History view in SourceTree and notice that your repository now has uncommitted changes.
  6. Selecting Stage file from the options menu of the files.

  7. Click the Commit button at the top to commit the file.
  8. In the message box, enter a commit message.
  9. Click the Commit button under the box. From Sourcetree's History, you'll see that the file has been updated on your new branch.

  10. Click the Push button to push your new branch to the repository.

  11. Under the Push? column from the dialog box that appears, select your new branch to indicate that you are pushing that branch to origin and click OK.
  12. Click the OK button to push changes to your local repository.

Last modified on Sep 27, 2018

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.