I've read about the unwanted side effects of cherry picking in regards to git history and ability to merge. However all examples I've come across assume that the branch, where a commit is cherry picked from, will continue to be actively developed-
In my case it is different. Since I am still learning about CICD (in particular in GitLab) I would often have the following approach:
- Create a project skeleton in my
master
ordevelop
branch depending on how the project is managed - Checkout a new branch for the CICD pipeline setup
- Experiment in that new branch until the pipeline is fully functional
- Merge back into the source branch (
master
ordevelop
) - Delete the branch for the pipeline
The problem here is that my playground branch is filled with commits such as "Added log message to debug error XYZ" or "Trying to adjust XYZ". The number of such commits can be astonishingly high (I am working on a Django project currently where this branch accumulated over 200 commits until the pipeline was finally working!). In the grand scheme of things this will create clutter in the git history, which I would like to avoid (not to mention it shows my incompetence in setting up a CICD pipeline :D).
I was thinking of using git cherry picking to just select the last commit and move it to the source branch thus leaving no trail behind. It is important to note that, while working on my pipeline setup branch, the source branch is not changed at all.
Will this break something in the git history of the branch that will receive the new data?