Background / scenario
I have a local work flow where
- I always commit on a "local" branch (ancestor of "master"), using commit messages beginning with issue number, such as "#123: Some message".
- I create feature branches which are also ancestors of "master".
- I then use rebase and/or cherry-pick to copy the commits from local onto the respective feature branch.
E.g. one way to do this:
git checkout local
git checkout -b 123-my-feature
git rebase -i master
In the interactive rebase editor, remove all commits where the message does not begin with #123. This leaves a feature branch 123-my-feature which only contains commits from the issue #123.
Later, after the branch 123-my-feature already exists, subsequent commits on local also need to be picked / copied onto the 123-my-feature branch, if the message begins with #123. This is also possible with interactive rebase, or with individual cherry-picks. But the process is cumbersome.
Question
Is there a way to do this with cherry-pick, and automatically filter by commit message?
E.g.
git checkout master
git checkout -b 123-my-feature
git cherry-pick master..local --commit-message-begins-with="#123"
Or maybe even an interactive cherry-pick, where I can manually remove commits not beginning with "#123".
If there is another command which achieves this, why not. Doesn't have to be cherry-pick.