The branches panel displays your branches, local and remote, as well as tags in the repository. It allows to switch between branches, perform actions on them and more.

Series index

lazygit with branches panel highlighted

Overview

The branches panel is the third panel from the top and thus has the hotkey 3.

The branches panel

In the above screenshot, the branches panel shows the current checked out branch with an asterisk at the top, as well as commits ahead (arrow up) and commits behind (arrow down) the remote tracking branch, if any.

It offers a variety of actions, let's go through them.

To switch between local branches, navigate the list with arrow keys and use the space key to check out the selected branch.

To navigate to the next or previous page of the list, use , and , respectively.

You can also check out a branch by name with c using an autocompleter, or hit / to start searching for branches in the list.

Remote branches and tags

The same keys apply to the two other tabs of the branches panel: remote branches and tags. Use ] and [ to move to the next and previous tab, respectively.

You have mostly the same actions available as for the local branches, except that you have to drill into the remotes first with enter.

Updating branches

To fast-forward a local branch from its remote tracking branch, you can use f on a selected branch. It does not need to be the checked out branch.

For the selected branch, use p to pull from the remote. Use the configuration file to control what the pull action does like with git config pull.*.

Exploring commits

To explore the commits of a branch without switching to it, use enter. You can drill down into individual commits with enter again, or move back up with escape.

Creating new branches

To create and check out a new branch, hit n to open a dialog, in which you type the branch name and press enter to check it out. It is checked out based on the currently checked out branch.

In case you want to rename the new or an existing branch, use R.

Merging and rebasing

If you want to merge a branch into the currently checked out branch, select it in the list and use M.

In the same way, use r to rebase the current branch on the selected one.

You will be asked for confirmation for any of the above actions.

Dangerous actions

If you have local changes and want to forcefully checkout a branch (losing all local changes), navigate the branches list and use F.

To delete a branch, select it in the list and use d.

You will be asked for confirmation for any of the above actions.

Next post in series

Click here for the next post: Deep dive: commits panel