I have a script that cherry-picks a commit using shelljs
.
Here is my LOC that does cherry-picking using shelljs
.
shell.exec('git cherry-pick commitid -X theirs');
Note: commitid = sha of commit I want to cherry-pick.
shelljs is throwing the following error:
fatal: bad object: commitid
e.g
fatal: bad object: 7854484884 (commitid)
I found out the issue.
My project structure looks like this:
project1 (git repo)
cherrypick.js
project2 (another git repo)
I wanted to cherry-pick a commit in project2 and merge it in different branch.
But the code written was in project1. Hence I had to add this line and it works.
shell.exec('cd project2');
shell.exec('git cherry-pick commitid -X theirs');