Git Commands
An overview of the most important Git commands
Git Commands featured image

git branch

The "branch" command helps you create, delete, and list branches.

It's the go-to command when it comes to managing any aspect of your branches - no matter if in your local repository or on your remotes.

Important Options

-v -a

Provides more information about all your branches. Listing your branches, by default, will only show your local branches' names.

  • Adding the "-a" flag will make sure remote branches are also included in the list.
  • Adding the "-v" flag will make the command more "verbose" and include SHA-1 hashes as well as commit subjects of the latest commits on your branches.


Returns all branches that have not been merged into your current HEAD branch. This helps you understand which changes haven't been integrated into your current working context, yet. Note that you can also request all branches that already have been merged in your current HEAD by using the "--merged" option instead.

-d <branch>

Deletes a specified branch.

  • If the specified branch hasn't been fully merged yet, you'll have to use the capital "-D" flag. Be careful with this, though: deleting branches that contain unmerged data shouldn't be done lightly.
  • If you want to delete a remote branch, add the "-r" flag in addition to "-d".


Create a new local branch based on your currently checked out branch. If you also provide a SHA-1 hash of a specific revision, your new branch will use that commit as its starting point.

The Git Cheat Sheet

No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!

Usage Examples

You can list all branches (both local and remote), including the SHA-1 hashes and commit subjects that these branches currently point to:

$ git branch -a -v
  * master 609d1ee New icons for “teams” page
    feature/login 82a0f21 Add test cases

Using the "--no-merged" option, you can find out which of your local branches have not been integrated into your current HEAD branch, yet:

$ git branch --no-merged

In case you want to clean up and delete branches that have already been integrated, you could use "--merged" to find these branches and then delete them using "-d":

$ git branch --merged
$ git branch -d feature/login feature/newsletter

To create a new branch, simply specify a name - and possibly a starting point, in case you don't want it to start at your current HEAD branch's state:

$ git branch feature/logout b84f02e


Use Drag & Drop to Manage Branches

The Tower Git client allows you to create, merge, rebase, push, and pull your branches - simply via Drag and Drop!

Try it free for 30 days and see why 100,000 developers all over the world use Tower to be more productive with Git!

Learn More

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.