Skip to main content

Detect which commits are absent between branches.

Project description

Branch Detective

Are you baffled by backports? Confused by cherry-picks? Muddled by merges? Branch Detective is the easy way to see what commits are present in one branch and absent from the other.

To use, just run branch-detective from the Git repository you're examining, and pass the two branches you're comparing. The first branch is the source branch, where commits are coming from. The second branch is the destination branch, which you're search through for the commits in. If a commit is present in source, but not in destination, that commit is considered "missing".

To keep things simple, Branch Detective will not tell you about commits present in the desintation branch, but not in the source branch. To see these, rerun Branch Detective with the branches swapped.

Search by Message or SHA

Different Git platforms handle your repository in different ways. In some, it is possible to directly compare the unique SHAs of commits in different branches. However, in many cases, these SHAs are changed through merges, cherry-picks, rebases, and other history-altering changes.

By default, Branch Detective uses the commit message to determine if two commits are identical. It also knows how to ignore "cherry pick" footers to minimize false positives for missing commits.

If you prefer, you can pass the argument --by-sha to compare by commit SHA instead. This will check for commits in the destination branch that match the SHA either directly or via the cherry pick footer. Thus, if commit a1b2c3 is cherry-picked from the source branch into the destination branch, while it will actually have a different SHA, it will be considered a match by Branch Detective, since the cherry pick footer will contain the source SHA a1b2c3.

Ignore Merges...or Don't

If your Git platform generates merge commits in addition to the regular commits themselves, Branch Detective allows you to ignore merge commits altogether. This cuts through the muck of the merge process and shows you only those missing commits that actually contain real code changes.

By default, merge commits are considered. To ignore merge commits, pass the --ignore-merge flag.

Since When?

If you want to only inspect commits in a particular time range, you can use the --since and/or --before options. For both, pass a date in the form YYYY-MM-DD (e.g. --since 2022-01-01 or --before 2021-05-04).

Show Some or Show All

By default, Branch Detective shows you one commit at a time, and waits for you to hit enter to continue. However, if you want to see all the commits at once, such as if you're exporting the output to a file, pass the --show-all or -a flag to show all the missing commits at once.

branch-detective devel main --show-all

Potential Pitfalls

Branch Detective either looks at the commit message or the SHA. To minimize false positives or false negatives due to workflow, we ignore dates and authors as part of commit matching.

This does mean that if you have multiple commits with the same message, if only one is present in the destination branch, it will not see any of the commits in the source branch with the matching commit message as missing.

Installing Branch Detective

You can install Branch Detective directly from PyPI via pip. (We recommend you do this in a virtual environment.)

pip install branch-detective

Found a Bug? Need a Feature?

Please report bugs and missing features on the Branch Detective repository. Pull requests are also encouraged!

Project details


Download files

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

Source Distribution

branch-detective-1.0.1.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

branch_detective-1.0.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file branch-detective-1.0.1.tar.gz.

File metadata

  • Download URL: branch-detective-1.0.1.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for branch-detective-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ea280a54d0af31d2dfc8d9b7d81d5475f4489a2dd0209655750b9f9fc3490833
MD5 125736ebcfacb3cbe119471e3834962d
BLAKE2b-256 1a16880cab77f85e901662adeb04212109bd28e570346d34cf01c55c4c1fcc74

See more details on using hashes here.

File details

Details for the file branch_detective-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: branch_detective-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for branch_detective-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 785129eccaf3ddf74773a48ca64bda3b2ef97285dfa79717d71311636bbd3a86
MD5 d045a5abb52949e5559462df3c06f998
BLAKE2b-256 69ffee27bdcb5c7b59745854fa705ca741ebccc45bee63fb6fe5057d398ee89e

See more details on using hashes here.

Supported by

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