发布网友
共1个回答
热心网友
Android 系统开发会需要经常sync code,如果单独使用 repo sync 命令,会出现类似以下错误:
[plain] view plain copy
kernel-3.10/: discarding 1 commits
error: device/common/: device/common checkout 270d71d1cf6bca70c763edb4b6c2162ac9f5d680
error: vendor/google/: platform/vendor/google/ checkout 38ab36dd74b552833f67480c618507804626e4de
这是本地改动跟remote code冲突等原因引起,这里的本地改动也有可能是build 时候修改的。这个解决办法是进到对应的目录进行 checkout 操作.
也有在repo sync 之前下命令的时候一步到位的命令,会方便很多:
[plain] view plain copy
sudo chown -R user:user ./*;repo forall -c 'git reset --hard; git clean -f -d -x'; time repo sync; date;
chown 更改文件拥有者和所属组别。
repo forall 遍历 git 目录。
git reset --hard 是将当前HEAD 重置,不会留下之前的痕迹。
git clean 清除未追踪的文件。d是目录,f是文件。
最後再repo sync,这个时候download 下来的code 就是服务器上一致的code了。
另外,如果要单独sync一个git目录,可使用以下命令:
[plain] view plain copy
time repo sync git_dir;date