9

当您执行典型的“git clone https://github.com/foo/bar.git ”时,您会在当前目录中获得一个文件夹,其中包含该目录中的所有文件。

我正在寻找的是一个可选的命令行参数,它可以让你从那个 git repo(包括 .git 本身)中删除你发出克隆命令的目录中的所有文件。

如果这是一个问题,我正在使用 bash - 提前谢谢你!

4

2 回答 2

21

我明白你想要什么。您可以将 git 存储库初始化到您的主目录,然后添加远程源并拉取。

cd
git init
git remote add origin https://github.com/foo/bar.git
git pull
于 2013-03-08T00:18:29.313 回答
0

您正在寻找点.

git clone https://github.com/foo/bar.git .

从 git clone 手册页:

git clone [--template=<template_directory>]
          [-l] [-s] [--no-hardlinks] [-q] [-n] [--bare] [--mirror]
          [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]
          [--separate-git-dir <git dir>]
          [--depth <depth>] [--recursive|--recurse-submodules] [--] <repository>
          [<directory>]

其中 (target)directory 是最后一个参数。请注意,您必须确保当前文件夹.为空

于 2013-03-07T23:35:51.553 回答