是的,你可以自由地重新克隆一个Git
库在不同的目录是不包含.git
当前目录的子目录。但是,你甚至不需要那样做。如果你不关心你的构建产品和想Git
不变,你可以这样做是为了将它们全部删除,但离开跟踪原始文件:
$ git clean -dxf
-dxf
选项的含义:
-d Remove untracked directories in addition to untracked files. If an
untracked directory is managed by a different git repository, it
is not removed by default. Use -f option twice if you really want
to remove such a directory.
-x Don't use the standard ignore rules read from .gitignore (per
directory) and $GIT_DIR/info/exclude, but do still use the ignore
rules given with -e options. This allows removing all untracked
files, including build products. This can be used (possibly in
conjunction with git reset) to create a pristine working directory
to test a clean build.
-f, --force If the git configuration variable clean.requireForce is
not set to false, git clean will refuse to run unless given -f or
-n.
你绝对可以克隆repo多次(不同目标目录中的“git clone REPO target-dir”),但如果你没有触及任何东西,我不知道它是否会有所帮助。不知道这是什么软件,但是如果你需要重新生成一个makefile或者其他东西,可以查看自动配置工具。 – neocpp