Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: bad object xxx

Tags:

git

I tried reverting to a previous git commit with:

git revert xxx 

I'm now receiving this error as a response:

fatal: bad object xxx 

What am I doing wrong? How do I fix this?

like image 232
James A. Anderson Avatar asked Aug 06 '12 18:08

James A. Anderson


1 Answers

I don't know the exact reason why that happens. For me, it's because I forget to pull the entire repository to my local. I have 2 or more path, and each path pulls from different branch

/path/branch_a/ -> pulled from branch A /path/branch_b/ -> pulled from branch B 

on branch A, I made a few modification, and commit as usual. I want that commit (for example the commit ID is abcdef123) appears on branch B, so I use

$ cd /path/branch_b/ $ git branch   master   branch_a * branch_b   $ git cherry-pick abcdef123 

This gives me that kind of error. So I need to pull the entire repository before getting that commit

$ git pull remote: Counting objects: 257, done. remote: Compressing objects: 100% (58/58), done. remote: Total 216 (delta 187), reused 186 (delta 158) Receiving objects: 100% (216/216), 53.13 KiB | 43 KiB/s, done. Resolving deltas: 100% (187/187), completed with 38 local objects. From github.com:username/my_repo    abcdef3..80c0d68  branch_a    -> origin/branch_a Already up-to-date.  $ git cherry-pick abcdef123  [branch_b ccddeef] Some commit message 1 file changed, 1 insertion(+), 1 deletion(-) 
like image 87
Prabowo Murti Avatar answered Sep 27 '22 22:09

Prabowo Murti