#git #bisect #friendly #assist #assistant #assistive

bin+lib git-assist

A suite of friendly assistive git commands

1 unstable release

0.1.0 Aug 24, 2023

#7 in #assist

MPL-2.0 license

29KB
522 lines

git-assist

Docs.rs Crates.io Downloads Version

Synopsis

A friendly git assistant.

Installation

Install git-assist via:

cargo install git-assist

Usage

git-assist currently implements assistive features for the following git commands:

git bisect

git-assist currently implements the following commands related to git bisect:

git assist bisect skip-pull-requests [OPTIONS]

Usage: git-assist bisect skip-pull-requests [OPTIONS]

Options:
      --remote-url <REMOTE_URL>  Remote url to fetch pull requests from
      --good <GOOD>              A known "good" commit
      --bad <BAD>                A known "bad" commit
      --dry-run                  Perform a "dry" run
  -h, --help                     Print help

Most options can either be passed as command-line arguments or entered interactively, later on.

Why is the `skip-pull-requests`` sub-command useful?

Github supports three merging schemes:

  • Merge: When you click the default "Merge" pull request option on a pull request on GitHub.com, all commits from the feature branch are added to the base branch in a merge commit. The pull request is merged using the --no-ff option.
  • Squash and merge: When you select the "Squash and merge" option on a pull request on GitHub.com, the pull request's commits are squashed into a single commit.
  • Rebase and merge: When you select the Rebase and merge option on a pull request on GitHub.com, all commits from the topic branch (or head branch) are added onto the base branch individually without a merge commit.

All of these come with their pros and cons, when it comes to running git bisect to find the commit that introduced a bug.

  • Merge: No clear linear and thus ambiguous history.
  • Squash and merge: You basically lose a ton of useful information in the process of squashing, at the cost of git bisect running smoothly.
  • Rebase and merge: Unless all your commits leave your project in a buildable state at all times running git bisect is a noisy and labor-intensive business.

So what if one could combine the convenience of "Squash and merge" with the history-preserving nature of "Rebase and merge"?

What the skip-pull-requests sub-command does:

  1. fetch all pull requests associated with the repository's remote URL.
  2. filter out any pull request that doesn't overlap with the good..bad commit range.
  3. runs (or merely prints, in case of --dry-run) git bisect skip base..head^ for each pull request.

The general usage of the skip-pull-requests sub-command looks something like this:

git bisect start
git assist bisect skip-pull-requests --good <GOOD> --bad <BAD> ...
git bisect good <GOOD>
git bisect bad <BAD>
...

Contributing

Please read CONTRIBUTING.md for details on our code of conduct,
and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MPL-2.0 – see the LICENSE.md file for details.

Dependencies

~16–29MB
~494K SLoC