开发者

Unable to update the work directory using repo

I have local project which is a git repository. I have added this local project to Android manifest file. Whenever there is a new commit in my local repository, I am able to fetch my local project using repo开发者_Go百科 sync -n <local project>. However when I try to update the work directory using repo sync -l <local project> I get an error

error.GitError: try rev-list ('^0f4e601043d095c8920dad010e5814ef22a20f45', 'HEAD', '--'): fatal: bad object 0f4e601043d095c8920dad010e5814ef22a20f45

Can anybody provide pointer to resolve this.


I had this issue earlier today - I could not find the bad object, but it appeared to occur due to repo self-updating after putting all the projects in a headless state. Manually checking out master and doing a pull on all the sub-projects solved it for me.

If you are really lazy and have a lot of projects, the following bash command may make life easier:

for i in `ls -d */`; do cd $i; git checkout master; git pull origin master; cd ..; done;

Note: this command assumes that:

  • You are in repo's base directory and all subdirectories are git projects
  • You do not have any uncommitted changes (Use repo status to double check this)

It probably wouldn't be hard to make a script that was a bit more intelligent (recursion, looking for .git directory etc)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜