Skip to main content
  1. Learn center
  2. Software Development
  3. Guides
  4. Git tutorial
  5. How to use Git
  6. How to use branching in Git
GuidesSoftware DevelopmentBacklog
Git

Project and code management together.

How to use branching in Git

This tutorial’s previous section taught you how to set up Git, create and clone repositories, commit and pull changes, and more. Whether you followed along using Git with Windows, Mac, or Command Line, you’re ready to jump into branching.

If you missed our introduction to branching, you can revisit it here.

If you haven’t already, create a new directory named tutorial and initialize a Git repository with the git init command.

$ mkdir tutorial
$ cd tutorial
$ git init
Initialized empty Git repository in /Users/username/Desktop/tutorial/.git/

Then create a new file named myfile.txt in the "tutorial" directory with the below content, and commit the changes.

Anyone can learn Git with this tutorial and Backlog
$ git add myfile.txt
$ git commit -m "first commit"
[main (root-commit) a73ae49] first commit
  1 files changed, 1 insertions(+), 0 deletions(-)
    create mode 100644 myfile.txt

At this point, our history looks like this.

Current history

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life