Need help with git-machete?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

189 Stars 19 Forks MIT License 384 Commits 41 Opened issues


Probably the sharpest git repository organizer & rebase/merge workflow automation tool you've ever seen ;)

Services available


Need anything else?

Contributors list


Join the chat at CircleCI Read the Docs PyPI package PyPI package monthly downloads Snap License: MIT

<!-- The image is referenced by full URL, corresponding develop branch to ensure it renders correctly on -->

💪 git-machete is a robust tool that simplifies your git workflows.

🦅 The bird's eye view provided by git-machete makes merges/rebases/push/pulls hassle-free even when multiple branches are present in the repository (master/develop, your topic branches, teammate's branches checked out for review, etc.).

🎯 Using this tool, you can maintain small, focused, easy-to-review pull requests with little effort.

👁 A look at a

git machete status
gives an instant answer to the questions: * What branches are in this repository? * What is going to be merged (rebased/pushed/pulled) and to what?


git machete traverse
semi-automatically traverses the branches, helping you effortlessly rebase, merge, push and pull.

git machete discover, status and traverse

🔌 See also VirtusLab/git-machete-intellij-plugin — a port into a plugin for the IntelliJ Platform products, including PyCharm, WebStorm etc.


We suggest a couple of alternative ways of installation.

Instructions for installing bash and zsh completion scripts are provided in completion/

git-machete requires Python >= 3.6. Python 2.x is no longer supported.

Using Homebrew (macOS)

shell script
brew tap VirtusLab/git-machete
brew install git-machete

Using Snappy (most Linux distributions)

Tip: check the guide on installing snapd if you don't have Snap support set up yet in your system.

shell script
sudo snap install --classic git-machete

It can also be installed via Ubuntu Software (simply search for


Note: classic confinement is necessary to ensure access to the editor installed in the system (to edit e.g. .git/machete file or rebase TODO list).

Using PPA (Ubuntu)

Tip: run

sudo apt-get install -y software-properties-common
first if
is not available on your system.

shell script
sudo add-apt-repository ppa:virtuslab/git-machete
sudo apt-get update
sudo apt-get install -y python3-git-machete

Using rpm (Fedora/RHEL/CentOS/openSUSE...)

Download the rpm package from the latest release and install either by opening it in your desktop environment or with

rpm -i git-machete-*.noarch.rpm

Using AUR (Arch Linux)

Install the AUR package git-machete using an AUR helper of your preference.

Using Nix (macOS & most Linux distributions)

On macOS and most Linux distributions, you can install via Nix:

shell script
nix-channel --add unstable  # if you haven't set up any channels yet
nix-env -i git-machete

Using pip with sudo (system-wide install)

You need to have Python and

installed from system packages.

shell script
sudo -H pip install git-machete

Tip: pass an extra

flag to
pip install
to upgrade an already installed version.

Using pip without sudo (user-wide install)

You need to have Python and

installed from system packages.

shell script
pip install --user git-machete

Please verify that your

variable has

Tip: pass an extra

flag to
pip install
to upgrade an already installed version.

Quick start

Discover the branch layout

shell script
cd your-repo/
git machete discover

See and possibly edit the suggested layout of branches. Branch layout is always kept as a

text file.

See the current repository state

shell script
git machete status --list-commits

Green edge means the given branch is in sync with its parent.
Red edge means it is out of sync — parent has some commits that the given branch does not have.
Gray edge means that the branch is merged to its parent.

Rebase, reset to remote, push, pull all branches as needed

shell script
git machete traverse --fetch --start-from=first-root

Put each branch one by one in sync with its parent and remote tracking branch.

Fast-forward current branch to match a child branch

shell script
git machete advance

Useful for merging the child branch to the current branch in a linear fashion (without creating a merge commit).

GitHub integration

Annotate the branches with GitHub PR numbers:

shell script
git machete github anno-prs

Check out the PR into local branch, also traverse chain of pull requests upwards, adding branches one by one to git-machete and check them out locally:

shell script
git machete github checkout-prs 

Create the PR, using the upstream (parent) branch from

as the base:
shell script
git machete github create-pr [--draft]

Sets the base of the current branch's PR to its upstream (parent) branch, as seen by git machete:

shell script
git machete github retarget-pr

Note: for private repositories, a GitHub API token with

access is required. This will be resolved from the first of: 1. The
env var. 2. The auth token from the current
configuration. 3. The auth token from the current


Find the docs at Read the Docs. You can also check

git machete help
git machete help 

Take a look at reference blog post for a guide on how to use the tool.

The more advanced features like automated traversal, upstream inference and tree discovery are described in the second part of the series.

Git compatibility

git-machete (since version 2.13.0) is compatible with git >= 1.8.0.


Contributions are welcome! See contributing guidelines for details. Help would be especially appreciated with Python code style and refactoring — so far more focus has been put on features, documentation and automating the distribution.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.