使用 git bash稀疏结帐的工作方法是:
git clone \
--depth 1 \
--filter=blob:none \
--sparse \
https://github.com/darc-coder/FindMyQRApp \
cd test-git-partial-clone
git sparse-checkout set js
Run Code Online (Sandbox Code Playgroud)
我们如何使用Tortoise Git - Git 克隆工具稀疏检出相同的代码?运行此命令时出现未知选项错误。
我们有一个包含很多项目的仓库。我只关心仓库中的“oracle”项目。然而,在拉下代码库后,我在其他文件夹中发现了名为“oracle”的子目录。有没有办法只获取匹配的父文件夹?
git init <repo>
cd <repo>
git remote add -f origin <url>
git config core.sparseCheckout true
echo "oracle/" >> .git/info/sparse-checkout
Run Code Online (Sandbox Code Playgroud)
#ls -l
oracle
directory123
directoryabc
#find . | grep "oracle"
directory123/sub1/sub2/oracle
directoryabc/sub1/sub2/sub3/oracle
Run Code Online (Sandbox Code Playgroud) 我有一个git repo,我只想下载某些子文件夹.我的配置如下所示:
#.git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sparsecheckout = true
[remote "dreamhost"]
url = <repo url>
fetch = +refs/heads/*:refs/remotes/dreamhost/*
[push]
default = tracking
Run Code Online (Sandbox Code Playgroud)
在.git/info/sparse-checkout我有这个:
themes/theme1
themes/theme8
Run Code Online (Sandbox Code Playgroud)
这是themes我想要的子文件夹中的文件夹.(我不需要其他人,其中很多).
如果我做一个git/pull我可以看到git获取很多东西,包括themes我不想要的子文件夹,这很好.我知道稀疏结账仍然会拉下物体.
我现在想要一份副本themes/theme15,进行一些修改.所以,我.git/info/sparse-checkout这样编辑:
themes/theme1
themes/theme8
themes/theme15
Run Code Online (Sandbox Code Playgroud)
然后做了一个git pull dreamhost master,认为git会添加theme15文件夹themes.但是,没有任何反应 - 它只是说
From <repo url>
* branch master -> FETCH_HEAD
Already up-to-date.
Run Code Online (Sandbox Code Playgroud)
和文件夹不在那里.谁能告诉我我做错了什么?编辑后还有一个额外的步骤.git/info/sparse-checkout吗?
谢谢,马克斯
编辑:这是git version 2.8.1顺便说一句
我想在某个标签上创建一个 git 存储库的稀疏和浅层克隆。
这就是我目前正在做的事情:
git init avatica-tmp
cd avatica-tmp
git remote add origin https://github.com/apache/calcite-avatica/
git config core.sparsecheckout true
echo "core/src/main/protobuf/*" >> .git/info/sparse-checkout
git pull --depth=1 origin rel/avatica-1.10.0
Run Code Online (Sandbox Code Playgroud)
它工作正常,但抛出错误:
remote: Counting objects: 531, done.
remote: Compressing objects: 100% (381/381), done.
remote: Total 531 (delta 147), reused 280 (delta 51), pack-reused 0
Receiving objects: 100% (531/531), 963.03 KiB | 233.00 KiB/s, done.
Resolving deltas: 100% (147/147), done.
From https://github.com/apache/calcite-avatica
* tag rel/avatica-1.10.0 -> FETCH_HEAD
fatal: update_ref failed for ref 'HEAD': cannot update …Run Code Online (Sandbox Code Playgroud) 在2015年的F8会议视频(从8:40开始)中,他们谈到了使用Mercurial和Facebook上的单个存储库的优势.
这在实践中如何运作?使用Mercurial,我可以签出一个子目录(住在SVN)吗?如果是这样,怎么样?我需要一个Facebook的善变扩展此
我已经丢失了所有分支的 git 中的所有项目数据,并且无法恢复。
我创建了三个分支:'master'、'distribution'和'remoteerp'(全部具有相同的代码,仅备份)并签出到remoteerp,然后我将稀疏签出配置配置为 true 并将/.git/info/sparse-checkout文件更新为/inoERP/inoerp/www/和/inoERP/inerp/inoerp-server。然后,我从 github 中提取了我的 fork-project,如下所示:
git remote add -f githubinoerp [github_url_to_my_fork_repo]
git pull githubinoerp master
Run Code Online (Sandbox Code Playgroud)
这会导致 License.txt 和 Copyright.txt 发生冲突,并且仅在工作目录中显示这些文件。由于我无法解决合并冲突(我仍在作为初学者学习 git),我只是尝试使用重置为旧状态,git reset --hard但它没有改变任何接受说类似sparse-checkout has changed your working directory. 随后检出其他分支(如分发和主分支)也不会显示原始文件。我已经在(签出后)所有分支上尝试过 git reset Head --hard 和 git reset --hard 但没有用。
我怎样才能将我的项目恢复到旧状态?