Skip to main content

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

Project description

git-machete

Join the chat at https://gitter.im/VirtusLab/git-machete CircleCI PyPI package PyPI package monthly downloads Snap License: MIT

💪 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.

Install

We suggest a couple of alternative ways of installation.

Bash and zsh completion scripts are provided in completion/ directory, see wiki for their installation instructions.

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

Using Homebrew (macOS)

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.

sudo snap install --classic git-machete

It can also be installed via Ubuntu Software (simply search for git-machete).

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 add-apt-repository is not available on your system.

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:

nix-channel --add https://nixos.org/channels/nixos-unstable 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 pip installed from system packages.

sudo -H pip install git-machete

Tip: pass an extra -U flag to pip install to upgrade an already installed version.

Using pip without sudo (user-wide install)

You need to have Python and pip installed from system packages.

pip install --user git-machete

Please verify that your PATH variable has ${HOME}/.local/bin/ included.

Tip: pass an extra -U flag to pip install to upgrade an already installed version.


Quick start

Discover the branch layout

cd your-repo/
git machete discover

See and possibly edit the suggested layout of branches. Branch layout is always kept as a .git/machete text file.

See the current repository state

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

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

git machete advance

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

GitHub integration

git machete anno --sync-github-prs

This will automatically annotate the branches with GitHub PR numbers.

Note: for private repositories, a GitHub API token with repo access is required. This will be resolved from the first of:

  1. The GITHUB_TOKEN env var.
  2. The auth token from the current gh configuration.
  3. The auth token from the current hub configuration.

Reference

See git machete help and git machete help <command> for reference.

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

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.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git-machete-3.3.0.tar.gz (60.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

git_machete-3.3.0-py3.9.egg (109.6 kB view details)

Uploaded Egg

git_machete-3.3.0-py3.8.egg (109.6 kB view details)

Uploaded Egg

git_machete-3.3.0-py3.7.egg (109.1 kB view details)

Uploaded Egg

git_machete-3.3.0-py3.6.egg (109.1 kB view details)

Uploaded Egg

git_machete-3.3.0-py2.py3-none-any.whl (53.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file git-machete-3.3.0.tar.gz.

File metadata

  • Download URL: git-machete-3.3.0.tar.gz
  • Upload date:
  • Size: 60.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for git-machete-3.3.0.tar.gz
Algorithm Hash digest
SHA256 68150fd7d9c6330ac67876ec0adc9dd10d6a08f59fc023a056406e3e56850657
MD5 c21aca02f9dbf085cdbe4b92b41e2510
BLAKE2b-256 88eef857fc5be7fb5bddb367544b3435196e964000e6da71cd53b6c97319080b

See more details on using hashes here.

File details

Details for the file git_machete-3.3.0-py3.9.egg.

File metadata

  • Download URL: git_machete-3.3.0-py3.9.egg
  • Upload date:
  • Size: 109.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for git_machete-3.3.0-py3.9.egg
Algorithm Hash digest
SHA256 c3837569b47f54143609c879627952592ae4a3c1f7f0f1af33e0c6fe240f30f3
MD5 4ba6fcd7772c0719eeeeaf2580ef4e30
BLAKE2b-256 c91a7d4bd8911faa2662cd54407b15f2c9c5b61fa4eef5a2a8a4c78523b8ce16

See more details on using hashes here.

File details

Details for the file git_machete-3.3.0-py3.8.egg.

File metadata

  • Download URL: git_machete-3.3.0-py3.8.egg
  • Upload date:
  • Size: 109.6 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for git_machete-3.3.0-py3.8.egg
Algorithm Hash digest
SHA256 1953371d3879a61d944915c0227b7774fb028091d6ee462af3c15c2985d7031b
MD5 3762238fcc0f59a895ec24b3c378443c
BLAKE2b-256 b37e2308509f8993080131b70e9fbab07370ffcc986d9d261da536311e6a97d9

See more details on using hashes here.

File details

Details for the file git_machete-3.3.0-py3.7.egg.

File metadata

  • Download URL: git_machete-3.3.0-py3.7.egg
  • Upload date:
  • Size: 109.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for git_machete-3.3.0-py3.7.egg
Algorithm Hash digest
SHA256 73f0eb9a195392e9b55f526a538abf0582428d77bdf51a8730c382c700a9fe6e
MD5 783d0b585555300802e4f993173567df
BLAKE2b-256 74a8baa136686d14d234c782f71aabf972d750389e694078ca7d554c2f852c63

See more details on using hashes here.

File details

Details for the file git_machete-3.3.0-py3.6.egg.

File metadata

  • Download URL: git_machete-3.3.0-py3.6.egg
  • Upload date:
  • Size: 109.1 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for git_machete-3.3.0-py3.6.egg
Algorithm Hash digest
SHA256 fadc15df7bddbc0e1098d10d92e2f30501d933f4fb9f22105cf5786ef091e0df
MD5 aeb9e3f5080bb901d504021890aa8325
BLAKE2b-256 a4d030d81554ad5b85fdd4be9c2faa6ba95d5b31b032747887a8177fb55e8c0d

See more details on using hashes here.

File details

Details for the file git_machete-3.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: git_machete-3.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 53.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.1

File hashes

Hashes for git_machete-3.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6a6d11887cbde39ab0851f30eff04394493cb63b173e59b11bb5dc51015c82a4
MD5 954d33d0d90a2cdfc458a94fc2b6311b
BLAKE2b-256 ca2c3cbd53baf68b20c2b64e4b69c356cda14126ab3626c2624288ea6f0006df

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page