If you specify a gem with a github url and branch in your Gemfile, you can occasionally run into the following problem:
fatal: Could not parse object '261964fdec8051e5d55f85e9074ed77be555e8a5'.
Git error: command `git reset --hard 261964fdec8051e5d55f85e9074ed77be555e8a5` in directory
If this error persists you could try removing the cache directory
You will scratch your head because the branch is definitely available on github, so what gives?
Removing the cache directory doesn’t change the outcome either.
Solution: The root of the problem is that Bundler saves the last commit ID of the branch in Gemfile.lock, and next time you try to run bundler install it will try to pull the same commit ID.
IF the repo owner has removed the last used commit, say by merging it, git won’t be able to pull it any more, and gives up, blaming the local cache directory instead of the local Gemfile.lock
To solve this, run ‘bundle update’ which will ignore the contents of Gemfile.lock and refreshes it.