1

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) 
3
  • On the presumption that your git repo status is OK, are you certain that the commit id exists somewhere in the repo? That error regularly comes from when the commit itself is not present in the git history. Commented May 21, 2018 at 8:53
  • Yes repo is clean and the commit exists. Commented May 21, 2018 at 8:54
  • Do any of these items help you? stackoverflow.com/questions/11834108/fatal-bad-object-xxx Commented May 21, 2018 at 8:59

1 Answer 1

0

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'); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.