repo根目录文件提交

简介

当一个工程非常大时,通常会拆分成多个小工程.小工程用git管理,由小工程整组成一个大工程,大工程用repo管理
比如Android SDK项目,通常总包大小会有20G以上,二级目录有30多个.

├── Android.bp -> build/soong/root.bp
├── Makefile
├── README.md
├── art
├── bionic
├── bootable
├── bootstrap.bash -> build/soong/bootstrap.bash
├── bsp
├── build
├── build.sh
├── compatibility
├── cts
├── dalvik
├── developers
├── development
├── device
├── external
├── frameworks
├── hardware
├── kernel
├── knc
├── libcore
├── libnativehelper
├── packages
├── pdk
├── platform_testing
├── prebuilts
├── sdk
├── system
├── test
├── toolchain
├── tools
└── vendor

需求

在一级根目录中,有时候需要放一些单个文件,比如放一些README或者编译脚本,但是根目录下没有git管理.比如上面列的目录中的文件README.md,build.sh及连接 bootstrap.bash, Android.bp.

实现

修改.repo/manifests/default.xml
文件用copyfile实现从子目录中拷贝,
连接用linkfile实现从子目录中连接出来.


<manifest>
    <remote  name="origin"
        fetch="ssh://[email protected]:33/xx" />

    <default revision="dev" remote="origin" />

    <project path="build" name="build">
        <copyfile src="make/core/root.mk" dest="Makefile" />
        <copyfile src="soong/benew.sh" dest="build.sh" />
        <linkfile src="soong/root.bp" dest="Android.bp" />
        <linkfile src="soong/bootstrap.bash" dest="bootstrap.bash" />
    project>
    <project path="sdk" name="sdk" />
    <project path="dalvik" name="dalvik" />
    <project path="art" name="art" />
    <project path="toolchain" name="toolchain" />
    <project path="bionic" name="bionic" />
    <project path="tools" name="tools" />
    <project path="development" name="development" />
    <project path="system" name="system" />
    <project path="pdk" name="pdk" />
    <project path="bootable" name="bootable" />
    <project path="platform_testing" name="platform_testing" />
    <project path="compatibility" name="compatibility" />
    <project path="kernel" name="kernel" />
    <project path="test" name="test" />
    <project path="libcore" name="libcore" />
    <project path="hardware" name="hardware" />
    <project path="libnativehelper" name="libnativehelper" />
    <project path="knc" name="knc">
        <copyfile src="build/mk" dest="mk" />
    project>
    <project path="developers" name="developers" />
    <project path="packages" name="packages" />
    <project path="cts" name="cts" />
    <project path="frameworks" name="frameworks" />
    <project path="device" name="device" />
    <project path="external" name="external" />
    <project path="vendor" name="vendor" />
    <project path="bsp" name="bsp" />
    <project path="prebuilts" name="prebuilts" />
manifest>

修改完要提交
cd .repo/manifests/
然后用git命令提交
git add default.xml
git commit -m “copy new file”
git push origin default

作者:帅得不敢出门 谢绝转载

你可能感兴趣的:(Android平台,git,android)