Skip to main content

git-cherry-pick-helper

The tool aims to help with chaotic git workflows.

It provides a small shell with tab completion.

The Problem

Working on feature branches is good practice and should be done. However, I often end up using a production branch that has diverged from upstream. I do merge some of my feature branches. I also commit directly to this branch. Then I need to cherry-pick back onto the feature branches.

When I then later merge the upstream branch, git does not remove my cherry-picked commit. git log does not help with identifying which commits might still be applicable for upstream.

git-cherry-pick-helper shows what commits are only in the current branch and not upstream.

It allows to also exclude additional branches, which you might have pull requests open. You can also blacklist commits that are not suitable for upstream. It excludes commits that are cherry-picked. If the commit is not cleanly applied and modified, it still shows the commit, and can tell you how similar they are.

Example workflow

$ cd path/to/repo # or worktree
$ git stash # make sure this is in a clean state to avoid issues; optional
$ git-cherry-pick-helper
# Set which branch we want to take commits from
gcph> source mydevbranch
# We want to add those commits to a clean upstream branch
gcph> onto origin/next
# Ignore all commits that are already in feature branches
gcph> ignore origin/my-pr1 feature2
# Look what commits we might want to add print that
gcph> update
# If there is something we need to add to a new branch we can do this with
gcph> new my-new-feature
# Select feature branches by the above printed id
gcph> add my-new-feature 1 4 7
# Print the overview again and see what commits we have selected for inclusion
gcph> print
# If we are happy we can apply the change set
gcph> run

Different commands can be put in the same line, separted by ; - this makes the history even more useful:

gcph> source mydevbranch ; onto origin/next ; ignore origin/my-pr1 feature2 ; update

All commands

  • source <branch> set the source branch from which to cherry-pick commits.
  • onto <branch> set the branch onto which to add commits.
  • ignore_branch <branch> [<branch> ...] set the branch(es) of which all commits are excluded, e.g. commits that are already cherry-picked.
  • update [quiet] Update what commits are available.
  • print Print the current state.
  • blacklist_commits <commit> [<commit> ...] Set commits to be ignored. Note that the commits will be permanently blacklisted. This can be undone by modifying ~/.gcph_blacklist.
  • add <new-branch> <commit-id> [<commit-id> ...] Add commits to a new branch.
  • delete <new-branch> Delete a previous created branch.
  • info <commit-id> [<commit-id> ...] Show what commits are similar and how similar they are.
  • show <commit-id> [<commit-id> ...] Show the commit, similar to git show.
  • run Execute the changes and create new branches.
  • exit Exit without commiting any changes.

Metadata

Release files for git-cherry-pick-helper 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for git-cherry-pick-helper 0.1.1
File Size Uploaded
git_cherry_pick_helper-0.1.1.tar.gz 7.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for git-cherry-pick-helper 0.1.1
File Interpreter ABI Platform
git_cherry_pick_helper-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.1 kB

Release files / git_cherry_pick_helper-0.1.1.tar.gz

Download URL git_cherry_pick_helper-0.1.1.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
36b3445ba8788715b8f95f613c852fa88ffe394a14f4fb7e5ed9eec4480b0b85
BLAKE2b-256 checksum
How to use checksums
9875b3574add9d9b211ec78fa19182f6b5b94fc46bea69d7194534eb2a7609b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release files / git_cherry_pick_helper-0.1.1-py3-none-any.whl

Download URL git_cherry_pick_helper-0.1.1-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01da7608f0fdb6b5144cbeef9b606ff0a8bcbbaa98f1a0950bd331668f022893
BLAKE2b-256 checksum
How to use checksums
7769dc76fe7fa20ec89f683847ea458b62d1d398c9ce8e94b31877c495a1451d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page