summaryrefslogtreecommitdiff
path: root/doc/topics/git/partial_clone.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/topics/git/partial_clone.md')
-rw-r--r--doc/topics/git/partial_clone.md51
1 files changed, 51 insertions, 0 deletions
diff --git a/doc/topics/git/partial_clone.md b/doc/topics/git/partial_clone.md
index de25c8a3283..c976eda688a 100644
--- a/doc/topics/git/partial_clone.md
+++ b/doc/topics/git/partial_clone.md
@@ -1,3 +1,10 @@
+---
+stage: Create
+group: Source Code
+info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers"
+type: reference, howto
+---
+
# Partial Clone
As Git repositories grow in size, they can become cumbersome to work with
@@ -182,3 +189,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`.