1

We have recently started using GIT for our corporate projects, one of the team member created a branch called ABC in his local Forked copy and sent me a PR in my corporate accounts ABC branch

Now as the PR contains multiple commits i just want to pick a specific commit from corporate REPO's ABC branch and merge it with development branch, so being in development branch i called below command:

git cherry-pick 504f43aea6ad7b733434ef4510f3baaf3fc10d09

but this throws error fatal: bad object 504f43aea6ad7b733434ef4510f3baaf3fc10d09

Could anyone tell me what i did wrong, long back i had tried cherry-pick and it didn't worked either that time it came out that i didn't had the commit in my remote REPO and hence it was not recognizing the commit hash, but now i have the commit in remote REPO but still same issue.

Andrew C
  • 13,845
  • 6
  • 50
  • 57
Abbas
  • 4,948
  • 31
  • 95
  • 161
  • 4
    maybe `git fetch` first? – Andrew C Dec 01 '15 at 23:45
  • As @AndrewC suggests, the problem is that your local repository doesnt know anything about commits at your remote repository. I am not sure that `git fetch` will do the job, but checking out the branch locally will basically download the branch from remote repository to your local repository and then you will be able to cherry pick commits you want. – honzalilak Dec 01 '15 at 23:56
  • [Pro Git 2 - Remote Branches - Figure 3-24](https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches) may help. – Yue Lin Ho Dec 02 '15 at 02:26
  • Thanks @AndrewC git fetch helped, thanks a lot. – Abbas Dec 03 '15 at 14:40

0 Answers0