1.Repo upload时出现的missing blob问题解决方法
错误信息:
28850466@cnbjlx3976:~/upload/vendor/opps$ repo upload .
Upload project vendor/opps/:
branch newupload ( 1 commit, Mon Apr 11 17:24:52 2011 +0800):
ccb50c67 Update seekbar layout as to like music application
to review.me.net (y/n)? y
Counting objects: 1422, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (580/580), done.
Writing objects: 100% (1250/1250), 12.11 MiB | 1.70 MiB/s, done.
Total 1250 (delta 564), reused 1087 (delta 457)
fatal: Unpack error, check server log
error: unpack failed: error Missing blob c107a14782ddbb133fb5cff1d1f0e042e6ed0970
To ssh://
[email protected]:29418/platform/vendor/opps
! [remote rejected] newupload -> refs/for/ginger-dev (n/a (unpacker error))
error: failed to push some refs to 'ssh://
[email protected]:29418/platform/vendor/opps'
--------------------------------------------
[FAILED] vendor/opps/ newupload (Upload failed)
错误原因大概是因为本地索引坏了。解决步骤如下:
$git gc
$git pull --rebase
$repo upload .
2.git branch -r
3.当我cherry-pick了一个别的分支的topic到我当前branch,发现有很多冲突,但是呢,这个冲突我还不能确定如何merge,所以我想先不管这个topic,先去处理别的topic。这时就需要将现有分支恢复到之前最初状态,用一下命令:
$git reset --hard
4.新建立一个branch之后,有时候要从别的branch cherry-pick一些topic过来。gerrit上都提供每个change的cherry-pick地址。但是要注意的是,当这样cherry-pick过来的change,是完全的cherry-pick,不仅包含代码改动,也包含commit message.
当cherrypick过来的代码,如果要作为新的commit,就千万千万要记住删掉commit message中的Change-Id(是一个40为的sha字符串)那一行,要不就会提交到原有的change上去。一旦提交到原有的change上去之后,是不能删除的,如果你提交的还跟原有分支上的不一样那就惨了,就得像我一样把老的分支(譬如你的提交产生了path15,那么你就要把patch14的代码下载下来)的代码再cherrypick过来,然后修改成跟patch14一样的,再提交。。