Initial commit: 小南娘 - 面向可爱的蓝孩子的 git 学习实践项目
仿 Dress 的照片投稿仓库, 适配自建 Gitea 平台 git.xhmcl.com: - README / GUIDE (PR 教程) / CONTRIBUTING / Q&A / EXIF / PARTIAL_CLONE (中英双语) - A-Z + # 首字母目录结构 - .gitea: PR 模板、维护者名单、7 个纯 bash + API 的 Actions 工作流 (可选功能) Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
commit
cf17c9ea42
51 files changed
+2450
No files matched your search
@@ -0,0 +1,109 @@
|
||||
# Partial Clone Guide
|
||||
|
||||
[简体中文](../PARTIAL_CLONE.md)
|
||||
|
||||
The XiaoNanNiang repository contains a large number of images. Using only `--depth 1` skips old commits but still downloads all images in the current version. If you only intend to modify your own directory, it's recommended to combine partial clone with sparse checkout: Git first downloads commits and the directory structure, and only fetches files on demand when the selected directory is checked out.
|
||||
|
||||
> Requires Git 2.25 or higher. Run `git --version` to check.
|
||||
> The platform only serves HTTP(S) — use the `https://` URLs below.
|
||||
|
||||
## First Clone
|
||||
|
||||
Fork this repository on the platform first, then clone your own fork. Replace the username and directory with actual values:
|
||||
|
||||
```bash
|
||||
git clone --filter=blob:none --sparse --depth 1 https://git.xhmcl.com/<your-username>/dress-pr.git
|
||||
cd dress-pr
|
||||
|
||||
# Check out only your own directory; you can set it even if it does not exist remotely yet
|
||||
git sparse-checkout set '<first-letter>/<your-folder-name>'
|
||||
```
|
||||
|
||||
For example, to use `Y/Yueosa`:
|
||||
|
||||
```bash
|
||||
git sparse-checkout set 'Y/Yueosa'
|
||||
```
|
||||
|
||||
Now the working tree contains the root documents and `Y/Yueosa`, without other contributors' images. If the folder name starts with a digit or symbol, use the `#` directory and always quote the path:
|
||||
|
||||
```bash
|
||||
git sparse-checkout set '#/233'
|
||||
```
|
||||
|
||||
Next you can create directories, add photos, and use `git add`, `git commit` and `git push` as usual. Continue to the [Beginner Guide](GUIDE.md) for the full contribution workflow.
|
||||
|
||||
## Managing Checked-Out Directories
|
||||
|
||||
View the currently selected directories:
|
||||
|
||||
```bash
|
||||
git sparse-checkout list
|
||||
```
|
||||
|
||||
Add another directory while keeping existing ones:
|
||||
|
||||
```bash
|
||||
git sparse-checkout add 'A/AnotherName'
|
||||
```
|
||||
|
||||
When re-selecting directories, `set` replaces the previous directory list:
|
||||
|
||||
```bash
|
||||
git sparse-checkout set 'F/FirstName' 'S/SecondName'
|
||||
```
|
||||
|
||||
Git downloads files in newly selected directories as needed, so the smaller the directory, the less download and disk usage.
|
||||
|
||||
## Getting More History
|
||||
|
||||
`--depth 1` creates a shallow clone containing only the latest commit. Normal photo submission and PRs are unaffected; if you need the full history, run:
|
||||
|
||||
```bash
|
||||
git fetch --unshallow
|
||||
```
|
||||
|
||||
This fetches the complete commit history, while image contents are still fetched on demand by the partial clone.
|
||||
|
||||
## Restoring the Full Repository
|
||||
|
||||
If you just want all files of the current version in the working tree, disable sparse checkout:
|
||||
|
||||
```bash
|
||||
git sparse-checkout disable
|
||||
```
|
||||
|
||||
This downloads files not yet fetched for the current version and can be large. The repository keeps its partial clone settings, and old-version files continue to be fetched on demand.
|
||||
|
||||
If you really need to convert the repository to a full clone with all history and contents, continue with:
|
||||
|
||||
```bash
|
||||
git fetch --unshallow --no-filter
|
||||
git config --unset remote.origin.partialclonefilter
|
||||
git config --unset remote.origin.promisor
|
||||
```
|
||||
|
||||
If you already ran `git fetch --unshallow`, it will tell you the repository is not shallow; use `git fetch --no-filter` instead.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why do root documents still appear?
|
||||
|
||||
`git clone --sparse` uses cone mode by default. This mode keeps the repository root files so you can read `README.md`, `GUIDE.md` and other documentation directly.
|
||||
|
||||
### Why can't I see the directory I just selected?
|
||||
|
||||
Run `git sparse-checkout list` first to check the path, case and first-letter directory. New directories that don't exist remotely won't appear automatically; they show up in the working tree only after you create and add files.
|
||||
|
||||
### Does partial clone affect commits or PRs?
|
||||
|
||||
No. Files that are not checked out are still managed by Git and won't be deleted when you `git add` or commit your own directory. Only modify your own directory, and check your changes with `git status` before committing.
|
||||
|
||||
### Push fails with an authentication error?
|
||||
|
||||
The platform has no SSH. Push with the `https://` URL and authenticate with "username + access token". See Step 2 Method B of the [Beginner Guide](GUIDE.md) for how to generate a token.
|
||||
|
||||
## References
|
||||
|
||||
- [Git Documentation: Partial Clone](https://git-scm.com/docs/partial-clone)
|
||||
- [Git Documentation: Sparse Checkout](https://git-scm.com/docs/git-sparse-checkout)
|
||||
Reference in new issue
Block a user