I am writing a shell script to automate code retrofit between two different Git branches. The requirement is I get a list of Git commits(which I have stored in a database table) from one branch and replay those changes on the other branch, and for that I am using Git Cherry-Pick command as below.
git checkout target_branch
<Sql command to get commit list> | xargs git cherry-pick
The above fails altogether if there are conflicts while picking any of the commits, and I need to implement the following logic using a seperate parameter as input to the script
-> if parameter value is Abort, list the files for which conflicts occured while cherry picking and then clean the repo(i am using git reset --merge for cleaning)
-> if parameter value is Overwrite, overwrite the conflicting files with the version of the commit hash
I have tried many options, but the only thing left is to create a dummy branch by cherry picking only those commits and then merge the dummy with target, but I don't know how to create a new branch by cherry picks only.
Please suggest a way.
Thanks. Kumarjit