天天看點

git中cherry-pick報錯fatal: bad object commit_id的解決方法背景解決方法

背景

new_feature

分支上,想cherry-pick一下另一個分支

develop

上的送出,不想發生如下錯誤:

➜  test git:(p/new_feature) git cherry-pick commit_id     
fatal: bad object commit_id
           

解決方法

先到該commit所在的分支上,pull一下:

➜  test git:(p/new_feature) git checkout develop   
➜  test git:(develop) git pull origin develop   
           

然後再執行cherry-pick:

➜  test git:(develop) git checkout p/new_feature  
➜  test git:(p/new_feature) git cherry-pick commit_id