diff options
Diffstat (limited to 'doc/topics')
-rw-r--r-- | doc/topics/git/partial_clone.md | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/doc/topics/git/partial_clone.md b/doc/topics/git/partial_clone.md index de25c8a3283..528cb44d90a 100644 --- a/doc/topics/git/partial_clone.md +++ b/doc/topics/git/partial_clone.md @@ -182,3 +182,47 @@ For more details, see the Git documentation for # Checkout master git checkout master ``` + +## Remove partial clone filtering + +Git repositories with partial clone filtering can have the filtering removed. To +remove filtering: + +1. Fetch everything that has been excluded by the filters, to make sure that the + repository is complete. If `git sparse-checkout` was used, use + `git sparse-checkout disable` to disable it. See the + [`disable` documentation](https://git-scm.com/docs/git-sparse-checkout#Documentation/git-sparse-checkout.txt-emdisableem) + for more information. + + Then do a regular `fetch` to ensure that the repository is complete. To check if + there are missing objects to fetch, and then fetch them, especially when not using + `git sparse-checkout`, the following commands can be used: + + ```shell + # Show missing objects + git rev-list --objects --all --missing=print | grep -e '^\?' + + # Show missing objects without a '?' character before them (needs GNU grep) + git rev-list --objects --all --missing=print | grep -oP '^\?\K\w+' + + # Fetch missing objects + git fetch origin $(git rev-list --objects --all --missing=print | grep -oP '^\?\K\w+') + + # Show number of missing objects + git rev-list --objects --all --missing=print | grep -e '^\?' | wc -l + ``` + +1. Repack everything. This can be done using `git repack -a -d`, for example. This + should leave only three files in `.git/objects/pack/`: + - A `pack-<SHA1>.pack` file. + - Its corresponding `pack-<SHA1>.idx` file. + - A `pack-<SHA1>.promisor` file. + +1. Delete the `.promisor` file. The above step should have left only one + `pack-<SHA1>.promisor` file, which should be empty and should be deleted. + +1. Remove partial clone configuration. The partial clone-related configuration + variables should be removed from Git config files. Usually only the following + configuration must be removed: + - `remote.origin.promisor`. + - `remote.origin.partialclonefilter`. |