Skip to main content

Simplify cherry-picking for messy git workflows

Project description

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.

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

git_cherry_pick_helper-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

git_cherry_pick_helper-0.1.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file git_cherry_pick_helper-0.1.1.tar.gz.

File metadata

File hashes

Hashes for git_cherry_pick_helper-0.1.1.tar.gz
Algorithm Hash digest
SHA256 36b3445ba8788715b8f95f613c852fa88ffe394a14f4fb7e5ed9eec4480b0b85
MD5 a55832e3d2974ecaff7a0b5d2b987893
BLAKE2b-256 9875b3574add9d9b211ec78fa19182f6b5b94fc46bea69d7194534eb2a7609b9

See more details on using hashes here.

File details

Details for the file git_cherry_pick_helper-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for git_cherry_pick_helper-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 01da7608f0fdb6b5144cbeef9b606ff0a8bcbbaa98f1a0950bd331668f022893
MD5 e48a4a9ffcad381c5729684d4daae9d5
BLAKE2b-256 7769dc76fe7fa20ec89f683847ea458b62d1d398c9ce8e94b31877c495a1451d

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