git-machete


Namegit-machete JSON
Version 3.31.1 PyPI version JSON
download
home_pagehttps://github.com/VirtusLab/git-machete
SummaryProbably the sharpest git repository organizer & rebase/merge workflow automation tool you've ever seen
upload_time2024-12-11 15:53:56
maintainerNone
docs_urlNone
authorVirtusLab
requires_python<4,>=3.6
licenseMIT
keywords git
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # git-machete

[![homebrew formula](https://img.shields.io/homebrew/v/git-machete)](https://formulae.brew.sh/formula/git-machete)
[![homebrew formula monthly downloads](https://img.shields.io/homebrew/installs/dm/git-machete.svg)](https://formulae.brew.sh/formula/git-machete)
[![PyPI package](https://img.shields.io/pypi/v/git-machete.svg)](https://pypi.org/project/git-machete)
[![PyPI package monthly downloads](https://img.shields.io/pypi/dm/git-machete.svg)](https://pypistats.org/packages/git-machete)
[![Conda package](https://img.shields.io/conda/vn/conda-forge/git-machete.svg)](https://anaconda.org/conda-forge/git-machete)
[![Conda downloads](https://img.shields.io/conda/dn/conda-forge/git-machete.svg)](https://anaconda.org/conda-forge/git-machete)
[![Snap](https://snapcraft.io/git-machete/badge.svg)](https://snapcraft.io/git-machete)
<br/>
[![Read the Docs](https://readthedocs.org/projects/git-machete/badge/?version=latest)](https://git-machete.readthedocs.io/en/stable)
[![License: MIT](https://img.shields.io/github/license/VirtusLab/git-machete)](https://github.com/VirtusLab/git-machete/blob/master/LICENSE)
[![CircleCI](https://circleci.com/gh/VirtusLab/git-machete/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/VirtusLab/git-machete?branch=master)
[![codecov](https://codecov.io/gh/VirtusLab/git-machete/branch/develop/graph/badge.svg)](https://codecov.io/gh/VirtusLab/git-machete)

[//]: # (These images are referenced by full URLs to ensure they render correctly on https://pypi.org/project/git-machete/)
[//]: # (In fact, only the light-mode image is used in PyPI, the other one is cropped out when publishing the package. Still, using the same format for consistency)
<img src="https://raw.githubusercontent.com/VirtusLab/git-machete/master/graphics/logo/svg/with-name.svg#gh-light-mode-only"     style="width: 100%; display: block; margin-bottom: 10pt;" />

💪 git-machete is a robust tool that **simplifies your git workflows**.<br/>

🦅 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.).<br/>

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

[//]: # (The image is referenced by its full URL to ensure it renders correctly on https://pypi.org/project/git-machete/)
<p align="center">
    <img src="https://raw.githubusercontent.com/VirtusLab/git-machete/master/graphics/discover-status-traverse.gif"
         alt="git machete discover, status and traverse" />
</p>

🔌 See also [VirtusLab/git-machete-intellij-plugin](https://github.com/VirtusLab/git-machete-intellij-plugin#git-machete-intellij-plugin) &mdash;
a port into a plugin for the IntelliJ Platform products, including PyCharm, WebStorm etc.


## Install

We provide a couple of alternative ways of installation. See [PACKAGES.md](PACKAGES.md) for the full list.

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

### Using Homebrew (macOS & most Linux distributions)

```shell script
brew install git-machete
```

### Using pip

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

**For user-wide install:**
```shell script
pip install --user git-machete
```
Please verify that your `PATH` variable has `${HOME}/.local/bin/` included.

**For system-wide install:**
```shell script
sudo -H pip install git-machete  # system-wide install
```

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

### Using conda

```shell script
conda install -c conda-forge git-machete
```

### Using Scoop (Windows)

```shell script
scoop install git-machete
```

### Using snap (most Linux distributions)

**Tip:** check the [guide on installing snapd](https://snapcraft.io/docs/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 `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 apt-get via PPA (Ubuntu)

**Tip:** run `sudo apt-get install -y software-properties-common` first if `add-apt-repository` 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 Alpine, Arch, Gentoo & other Linux distro-specific package managers

Check [Repology](https://repology.org/project/git-machete/versions) for the available distro-specific packages.

### Using Nix (macOS & most Linux distributions)

On macOS and most Linux distributions, you can install via [Nix](https://nixos.org/nix):

```shell script
nix-channel --add https://nixos.org/channels/nixos-unstable unstable  # if you haven't set up any channels yet
nix-env -i git-machete
```

**Note:** since `nixos-21.05`, `git-machete` is included in the stable channels as well.
The latest released version, however, is generally available in the unstable channel.
Stable channels may lag behind; see [repology](https://repology.org/project/git-machete/versions) for the current channel-package mapping.

### Using Pex

The [Pex tool](https://github.com/pex-tool/pex) (short for Python EXecutable) allows you to build "pex" files which are executable Python environments in a single file.

Assuming you have already installed the `pex` utility, you can build git-machete as a pex:

```shell_script
pex git-machete -m git_machete.bin:main -o git-machete
```

Then put the produced `git-machete` file somewhere on your `PATH`.

<br/>

## 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 `.git/machete` text file, which can be edited directly or via `git machete edit`.

### See the current repository state
```shell script
git machete status --list-commits
```

**Green** edge means the given branch is **in sync** with its parent. <br/>
**Red** edge means it is **out of sync** &mdash; parent has some commits that the given branch does not have. <br/>
**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 merge a child branch into the current 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 & GitLab integration

Check out the given PRs into local branches, also traverse chain of pull requests upwards, adding branches one by one to git-machete and check them out locally as well: <br/>
```shell script
git machete github checkout-prs [--all | --by=<github-login> | --mine | <PR-number-1> ... <PR-number-N>]
git machete gitlab checkout-mrs [--all | --by=<gitlab-login> | --mine | <MR-number-1> ... <MR-number-N>]
```

Create the PR/MR, using the upstream (parent) branch from `.git/machete` as the base: <br/>
```shell script
git machete github create-pr [--draft]
git machete gitlab create-mr [--draft]
```

The entire chain of PRs/MRs will be posted in the PR/MR description (example for GitHub): <br/>

[//]: # (The image is referenced by its full URL to ensure it renders correctly on https://pypi.org/project/git-machete/)
<img src="https://raw.githubusercontent.com/VirtusLab/git-machete/master/graphics/pr-chain-github-screenshot.png"
     alt="PR chain on GitHub"
     width="75%" />

**Note**: for private repositories (or side-effecting operations like `create-pr`/`create-mr` on public repositories),
a GitHub API token with `repo` access or a GitLab API token with `api` access is required.
See the docs for [`github`](https://git-machete.readthedocs.io/#github)
or [`gitlab`](https://git-machete.readthedocs.io/#gitlab) for how to provide the token.

### Shell completions

When git-machete is installed via **Homebrew** (and a few other supported package managers, see [PACKAGES.md](PACKAGES.md)),
shell completions should be installed automatically. <br/>
For other package managers (like **pip**), or when your shell doesn't pick up the Homebrew-installed completion, use the following:

#### Bash

Put the following into `~/.bashrc` or `~/.bash_profile`:

```shell script
eval "$(git machete completion bash)"  # or, if it doesn't work:
source <(git machete completion bash)
```

#### Fish

Put the following into `~/.config/fish/config.fish`:

```shell script
git machete completion fish | source
```

#### Zsh

Put the following into `~/.zshrc`:

```shell script
eval "$(git machete completion zsh)"  # or, if it doesn't work:
source <(git machete completion zsh)
```

<br/>

## FAQ

#### I've run `git machete discover`... but the branch layout I see in `.git/machete` doesn't exactly match what I expected. Am I doing something wrong?

[//]: # (For how to find Medium header anchors, see https://www.freecodecamp.org/news/how-to-link-to-a-specific-paragraph-in-your-medium-article-2018-table-of-contents-method-e66595fea549/)
No! It's all right, `discover` is based on an (imperfect)
[heuristic](https://medium.com/virtuslab/git-machete-strikes-again-traverse-the-git-rebase-jungle-even-faster-with-v2-0-f43ebaf8abb0#0544)
which usually yields branch layout close to what the user would expect.
It still might not be perfect and &mdash; for example &mdash; declare branches to be children of `main`/`develop` instead of each other.

Just run [`git machete edit`](https://git-machete.readthedocs.io/en/stable/#edit) to fix the layout manually.
If you're working on JetBrains IDEs, you can use [git-machete IntelliJ plugin](https://github.com/VirtusLab/git-machete-intellij-plugin#git-machete-intellij-plugin)
to have branch name completion when editing `.git/machete` file.

Also, consider [`git machete github checkout-prs` or `git machete gitlab checkout-mrs`](#github--gitlab-integration)
instead of `git machete discover` if you already have GitHub PRs/GitLab MRs opened.

<br/>

#### Can I use `git merge` for dealing with stacked PRs?

There are two commonly used ways to put a branch back in sync with its base (parent) branch:
1. rebase the branch onto its base branch
2. merge the base branch into the branch

While git-machete supports merging base branch (like `main`) to update the branch
([`git machete traverse --merge`](https://git-machete.readthedocs.io/en/stable/#traverse)),
this approach **works poorly with stacked PRs**.
You might end up with a very tangled history very quickly, and a non-trivial sequence of `git cherry-pick`s might be needed to restore order.

That is why we recommend using rebase over merge for stacked PRs.
However, we still recommend using merge for the narrow case of [backporting hotfixes](https://slides.com/plipski/git-machete/#/11).

<br/>

#### Sometimes when I run `update` or `traverse`, too many commits are taken into the rebase... how to fix that?

Contrary to the popular misconception, git doesn't have a notion of
["commits belonging to a branch"](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell).
A branch is just a movable reference to a commit.

This makes it hard in general case to determine the range of commits that form the "unique history" of the given branch.
There's an entire algorithm in git-machete for determining the
[_fork point_](https://medium.com/virtuslab/make-your-way-through-the-git-rebase-jungle-with-git-machete-e2ed4dbacd02#1ac9)
of the branch (i.e. the place after which the unique history of the branch starts).

One thing that you can do to help fork-point algorithm in its job,
is to **not delete** local branches instantly after they're merged or discarded.
They (or specifically, their [reflogs](https://virtuslab.github.io/tips/#git/git-reflog)) will be still useful for a while
to determine fork points for other branches (and thus, the range of commits taken into rebase).

Also, you can always override fork point for a branch explicitly
with [`git machete fork-point --override-to...`](https://git-machete.readthedocs.io/#fork-point) command.

<br/>

## Reference

Find the docs at [Read the Docs](https://git-machete.readthedocs.io/).
You can also check `git machete help` and `git machete help <command>`.

For the excellent overview for the reasons to use small & stacked PRs,
see [Ben Congdon](https://github.com/bcongdon)'s [blog post](https://benjamincongdon.me/blog/2022/07/17/In-Praise-of-Stacked-PRs/).

Take a look at git-machete
[reference blog post](https://medium.com/virtuslab/make-your-way-through-the-git-rebase-jungle-with-git-machete-e2ed4dbacd02)
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](https://medium.com/virtuslab/git-machete-strikes-again-traverse-the-git-rebase-jungle-even-faster-with-v2-0-f43ebaf8abb0).

<br/>


## Git compatibility

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

<br/>


## Contributions

Contributions are welcome! See [contributing guidelines](CONTRIBUTING.md) for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/VirtusLab/git-machete",
    "name": "git-machete",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4,>=3.6",
    "maintainer_email": null,
    "keywords": "git",
    "author": "VirtusLab",
    "author_email": "gitmachete@virtuslab.com",
    "download_url": "https://files.pythonhosted.org/packages/ed/80/77d3aa3b4dc4d561aebdf8b92eea7d693f43312dd970cea79d2e05a2af56/git_machete-3.31.1.tar.gz",
    "platform": null,
    "description": "# git-machete\n\n[![homebrew formula](https://img.shields.io/homebrew/v/git-machete)](https://formulae.brew.sh/formula/git-machete)\n[![homebrew formula monthly downloads](https://img.shields.io/homebrew/installs/dm/git-machete.svg)](https://formulae.brew.sh/formula/git-machete)\n[![PyPI package](https://img.shields.io/pypi/v/git-machete.svg)](https://pypi.org/project/git-machete)\n[![PyPI package monthly downloads](https://img.shields.io/pypi/dm/git-machete.svg)](https://pypistats.org/packages/git-machete)\n[![Conda package](https://img.shields.io/conda/vn/conda-forge/git-machete.svg)](https://anaconda.org/conda-forge/git-machete)\n[![Conda downloads](https://img.shields.io/conda/dn/conda-forge/git-machete.svg)](https://anaconda.org/conda-forge/git-machete)\n[![Snap](https://snapcraft.io/git-machete/badge.svg)](https://snapcraft.io/git-machete)\n<br/>\n[![Read the Docs](https://readthedocs.org/projects/git-machete/badge/?version=latest)](https://git-machete.readthedocs.io/en/stable)\n[![License: MIT](https://img.shields.io/github/license/VirtusLab/git-machete)](https://github.com/VirtusLab/git-machete/blob/master/LICENSE)\n[![CircleCI](https://circleci.com/gh/VirtusLab/git-machete/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/VirtusLab/git-machete?branch=master)\n[![codecov](https://codecov.io/gh/VirtusLab/git-machete/branch/develop/graph/badge.svg)](https://codecov.io/gh/VirtusLab/git-machete)\n\n[//]: # (These images are referenced by full URLs to ensure they render correctly on https://pypi.org/project/git-machete/)\n[//]: # (In fact, only the light-mode image is used in PyPI, the other one is cropped out when publishing the package. Still, using the same format for consistency)\n<img src=\"https://raw.githubusercontent.com/VirtusLab/git-machete/master/graphics/logo/svg/with-name.svg#gh-light-mode-only\"     style=\"width: 100%; display: block; margin-bottom: 10pt;\" />\n\n\ud83d\udcaa git-machete is a robust tool that **simplifies your git workflows**.<br/>\n\n\ud83e\udd85 The _bird's eye view_ provided by git-machete makes **merges/rebases/push/pulls hassle-free**\neven when **multiple branches** are present in the repository\n(master/develop, your topic branches, teammate's branches checked out for review, etc.).<br/>\n\n\ud83c\udfaf Using this tool, you can maintain **small, focused, easy-to-review pull requests** with little effort.\n\n\ud83d\udc41 A look at a `git machete status` gives an instant answer to the questions:\n* What branches are in this repository?\n* What is going to be merged (rebased/pushed/pulled) and to what?\n\n\ud83d\ude9c `git machete traverse` semi-automatically traverses the branches, helping you effortlessly rebase, merge, push and pull.\n\n[//]: # (The image is referenced by its full URL to ensure it renders correctly on https://pypi.org/project/git-machete/)\n<p align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/VirtusLab/git-machete/master/graphics/discover-status-traverse.gif\"\n         alt=\"git machete discover, status and traverse\" />\n</p>\n\n\ud83d\udd0c See also [VirtusLab/git-machete-intellij-plugin](https://github.com/VirtusLab/git-machete-intellij-plugin#git-machete-intellij-plugin) &mdash;\na port into a plugin for the IntelliJ Platform products, including PyCharm, WebStorm etc.\n\n\n## Install\n\nWe provide a couple of alternative ways of installation. See [PACKAGES.md](PACKAGES.md) for the full list.\n\ngit-machete requires Python >= 3.6. Python 2.x is no longer supported.\n\n### Using Homebrew (macOS & most Linux distributions)\n\n```shell script\nbrew install git-machete\n```\n\n### Using pip\n\nYou need to have Python and `pip` installed from system packages.\n\n**For user-wide install:**\n```shell script\npip install --user git-machete\n```\nPlease verify that your `PATH` variable has `${HOME}/.local/bin/` included.\n\n**For system-wide install:**\n```shell script\nsudo -H pip install git-machete  # system-wide install\n```\n\n**Tip:** pass an extra `-U` flag to `pip install` to upgrade an already installed version.\n\n### Using conda\n\n```shell script\nconda install -c conda-forge git-machete\n```\n\n### Using Scoop (Windows)\n\n```shell script\nscoop install git-machete\n```\n\n### Using snap (most Linux distributions)\n\n**Tip:** check the [guide on installing snapd](https://snapcraft.io/docs/installing-snapd) if you don't have Snap support set up yet in your system.\n\n```shell script\nsudo snap install --classic git-machete\n```\n\nIt can also be installed via Ubuntu Software (simply search for `git-machete`).\n\n**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).\n\n### Using apt-get via PPA (Ubuntu)\n\n**Tip:** run `sudo apt-get install -y software-properties-common` first if `add-apt-repository` is not available on your system.\n\n```shell script\nsudo add-apt-repository ppa:virtuslab/git-machete\nsudo apt-get update\nsudo apt-get install -y python3-git-machete\n```\n\n### Using Alpine, Arch, Gentoo & other Linux distro-specific package managers\n\nCheck [Repology](https://repology.org/project/git-machete/versions) for the available distro-specific packages.\n\n### Using Nix (macOS & most Linux distributions)\n\nOn macOS and most Linux distributions, you can install via [Nix](https://nixos.org/nix):\n\n```shell script\nnix-channel --add https://nixos.org/channels/nixos-unstable unstable  # if you haven't set up any channels yet\nnix-env -i git-machete\n```\n\n**Note:** since `nixos-21.05`, `git-machete` is included in the stable channels as well.\nThe latest released version, however, is generally available in the unstable channel.\nStable channels may lag behind; see [repology](https://repology.org/project/git-machete/versions) for the current channel-package mapping.\n\n### Using Pex\n\nThe [Pex tool](https://github.com/pex-tool/pex) (short for Python EXecutable) allows you to build \"pex\" files which are executable Python environments in a single file.\n\nAssuming you have already installed the `pex` utility, you can build git-machete as a pex:\n\n```shell_script\npex git-machete -m git_machete.bin:main -o git-machete\n```\n\nThen put the produced `git-machete` file somewhere on your `PATH`.\n\n<br/>\n\n## Quick start\n\n### Discover the branch layout\n\n```shell script\ncd your-repo/\ngit machete discover\n```\n\nSee and possibly edit the suggested layout of branches.\nBranch layout is always kept as a `.git/machete` text file, which can be edited directly or via `git machete edit`.\n\n### See the current repository state\n```shell script\ngit machete status --list-commits\n```\n\n**Green** edge means the given branch is **in sync** with its parent. <br/>\n**Red** edge means it is **out of sync** &mdash; parent has some commits that the given branch does not have. <br/>\n**Gray** edge means that the branch is **merged** to its parent.\n\n### Rebase, reset to remote, push, pull all branches as needed\n```shell script\ngit machete traverse --fetch --start-from=first-root\n```\n\nPut each branch one by one in sync with its parent and remote tracking branch.\n\n### Fast-forward merge a child branch into the current branch\n```shell script\ngit machete advance\n```\n\nUseful for merging the child branch to the current branch in a linear fashion (without creating a merge commit).\n\n### GitHub & GitLab integration\n\nCheck out the given PRs into local branches, also traverse chain of pull requests upwards, adding branches one by one to git-machete and check them out locally as well: <br/>\n```shell script\ngit machete github checkout-prs [--all | --by=<github-login> | --mine | <PR-number-1> ... <PR-number-N>]\ngit machete gitlab checkout-mrs [--all | --by=<gitlab-login> | --mine | <MR-number-1> ... <MR-number-N>]\n```\n\nCreate the PR/MR, using the upstream (parent) branch from `.git/machete` as the base: <br/>\n```shell script\ngit machete github create-pr [--draft]\ngit machete gitlab create-mr [--draft]\n```\n\nThe entire chain of PRs/MRs will be posted in the PR/MR description (example for GitHub): <br/>\n\n[//]: # (The image is referenced by its full URL to ensure it renders correctly on https://pypi.org/project/git-machete/)\n<img src=\"https://raw.githubusercontent.com/VirtusLab/git-machete/master/graphics/pr-chain-github-screenshot.png\"\n     alt=\"PR chain on GitHub\"\n     width=\"75%\" />\n\n**Note**: for private repositories (or side-effecting operations like `create-pr`/`create-mr` on public repositories),\na GitHub API token with `repo` access or a GitLab API token with `api` access is required.\nSee the docs for [`github`](https://git-machete.readthedocs.io/#github)\nor [`gitlab`](https://git-machete.readthedocs.io/#gitlab) for how to provide the token.\n\n### Shell completions\n\nWhen git-machete is installed via **Homebrew** (and a few other supported package managers, see [PACKAGES.md](PACKAGES.md)),\nshell completions should be installed automatically. <br/>\nFor other package managers (like **pip**), or when your shell doesn't pick up the Homebrew-installed completion, use the following:\n\n#### Bash\n\nPut the following into `~/.bashrc` or `~/.bash_profile`:\n\n```shell script\neval \"$(git machete completion bash)\"  # or, if it doesn't work:\nsource <(git machete completion bash)\n```\n\n#### Fish\n\nPut the following into `~/.config/fish/config.fish`:\n\n```shell script\ngit machete completion fish | source\n```\n\n#### Zsh\n\nPut the following into `~/.zshrc`:\n\n```shell script\neval \"$(git machete completion zsh)\"  # or, if it doesn't work:\nsource <(git machete completion zsh)\n```\n\n<br/>\n\n## FAQ\n\n#### I've run `git machete discover`... but the branch layout I see in `.git/machete` doesn't exactly match what I expected. Am I doing something wrong?\n\n[//]: # (For how to find Medium header anchors, see https://www.freecodecamp.org/news/how-to-link-to-a-specific-paragraph-in-your-medium-article-2018-table-of-contents-method-e66595fea549/)\nNo! It's all right, `discover` is based on an (imperfect)\n[heuristic](https://medium.com/virtuslab/git-machete-strikes-again-traverse-the-git-rebase-jungle-even-faster-with-v2-0-f43ebaf8abb0#0544)\nwhich usually yields branch layout close to what the user would expect.\nIt still might not be perfect and &mdash; for example &mdash; declare branches to be children of `main`/`develop` instead of each other.\n\nJust run [`git machete edit`](https://git-machete.readthedocs.io/en/stable/#edit) to fix the layout manually.\nIf you're working on JetBrains IDEs, you can use [git-machete IntelliJ plugin](https://github.com/VirtusLab/git-machete-intellij-plugin#git-machete-intellij-plugin)\nto have branch name completion when editing `.git/machete` file.\n\nAlso, consider [`git machete github checkout-prs` or `git machete gitlab checkout-mrs`](#github--gitlab-integration)\ninstead of `git machete discover` if you already have GitHub PRs/GitLab MRs opened.\n\n<br/>\n\n#### Can I use `git merge` for dealing with stacked PRs?\n\nThere are two commonly used ways to put a branch back in sync with its base (parent) branch:\n1. rebase the branch onto its base branch\n2. merge the base branch into the branch\n\nWhile git-machete supports merging base branch (like `main`) to update the branch\n([`git machete traverse --merge`](https://git-machete.readthedocs.io/en/stable/#traverse)),\nthis approach **works poorly with stacked PRs**.\nYou might end up with a very tangled history very quickly, and a non-trivial sequence of `git cherry-pick`s might be needed to restore order.\n\nThat is why we recommend using rebase over merge for stacked PRs.\nHowever, we still recommend using merge for the narrow case of [backporting hotfixes](https://slides.com/plipski/git-machete/#/11).\n\n<br/>\n\n#### Sometimes when I run `update` or `traverse`, too many commits are taken into the rebase... how to fix that?\n\nContrary to the popular misconception, git doesn't have a notion of\n[\"commits belonging to a branch\"](https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell).\nA branch is just a movable reference to a commit.\n\nThis makes it hard in general case to determine the range of commits that form the \"unique history\" of the given branch.\nThere's an entire algorithm in git-machete for determining the\n[_fork point_](https://medium.com/virtuslab/make-your-way-through-the-git-rebase-jungle-with-git-machete-e2ed4dbacd02#1ac9)\nof the branch (i.e. the place after which the unique history of the branch starts).\n\nOne thing that you can do to help fork-point algorithm in its job,\nis to **not delete** local branches instantly after they're merged or discarded.\nThey (or specifically, their [reflogs](https://virtuslab.github.io/tips/#git/git-reflog)) will be still useful for a while\nto determine fork points for other branches (and thus, the range of commits taken into rebase).\n\nAlso, you can always override fork point for a branch explicitly\nwith [`git machete fork-point --override-to...`](https://git-machete.readthedocs.io/#fork-point) command.\n\n<br/>\n\n## Reference\n\nFind the docs at [Read the Docs](https://git-machete.readthedocs.io/).\nYou can also check `git machete help` and `git machete help <command>`.\n\nFor the excellent overview for the reasons to use small & stacked PRs,\nsee [Ben Congdon](https://github.com/bcongdon)'s [blog post](https://benjamincongdon.me/blog/2022/07/17/In-Praise-of-Stacked-PRs/).\n\nTake a look at git-machete\n[reference blog post](https://medium.com/virtuslab/make-your-way-through-the-git-rebase-jungle-with-git-machete-e2ed4dbacd02)\nfor a guide on how to use the tool.\n\nThe more advanced features like automated traversal, upstream inference and tree discovery are described in the\n[second part of the series](https://medium.com/virtuslab/git-machete-strikes-again-traverse-the-git-rebase-jungle-even-faster-with-v2-0-f43ebaf8abb0).\n\n<br/>\n\n\n## Git compatibility\n\ngit-machete (since version 2.13.0) is compatible with git >= 1.8.0.\n\n<br/>\n\n\n## Contributions\n\nContributions are welcome! See [contributing guidelines](CONTRIBUTING.md) for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Probably the sharpest git repository organizer & rebase/merge workflow automation tool you've ever seen",
    "version": "3.31.1",
    "project_urls": {
        "Homepage": "https://github.com/VirtusLab/git-machete"
    },
    "split_keywords": [
        "git"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e068c1973b7748447fafe6d231d37bcaa8865904b501ff7e1c491973f88b0b20",
                "md5": "57c4cd96dd4a70cfb47c2df9aa899d63",
                "sha256": "aba76a6cfd2e77ef69da5a763d433d6a54d23ee6b6f939d99da4187e0b2a830e"
            },
            "downloads": -1,
            "filename": "git_machete-3.31.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "57c4cd96dd4a70cfb47c2df9aa899d63",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4,>=3.6",
            "size": 145745,
            "upload_time": "2024-12-11T15:53:54",
            "upload_time_iso_8601": "2024-12-11T15:53:54.105441Z",
            "url": "https://files.pythonhosted.org/packages/e0/68/c1973b7748447fafe6d231d37bcaa8865904b501ff7e1c491973f88b0b20/git_machete-3.31.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed8077d3aa3b4dc4d561aebdf8b92eea7d693f43312dd970cea79d2e05a2af56",
                "md5": "4a1ef772f8f6430c9a7a871b06a4cc94",
                "sha256": "fdb3aeb8c1fe1fd8bcb362259a50e2c285a8aab29e84e598a1220d3b235960d7"
            },
            "downloads": -1,
            "filename": "git_machete-3.31.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4a1ef772f8f6430c9a7a871b06a4cc94",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4,>=3.6",
            "size": 140514,
            "upload_time": "2024-12-11T15:53:56",
            "upload_time_iso_8601": "2024-12-11T15:53:56.736617Z",
            "url": "https://files.pythonhosted.org/packages/ed/80/77d3aa3b4dc4d561aebdf8b92eea7d693f43312dd970cea79d2e05a2af56/git_machete-3.31.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 15:53:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "VirtusLab",
    "github_project": "git-machete",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "tox": true,
    "lcname": "git-machete"
}
        
Elapsed time: 0.38481s