Skip to content

Commit 13354f5

Browse files
peffgitster
authored andcommitted
docs: describe impact of repack on "clone -s"
The effects of repacking on a repository with alternates are a bit subtle. The two main things users will want are: 1. Not to waste disk space by accidentally copying objects which could be shared. 2. Copying all objects explicitly to break the dependency on the source repo. This patch describes both under the "clone -s" documentation. It makes sense to put it there rather than in git-repack.txt for both cases. For (1), we are warning the user who is using "clone -s" about what _not_ to do, so we need to get their attention when reading about "clone -s". For (2), we are telling them how git-repack can be used to accomplish a task, but until they know that git-repack is the right tool, they have no reason to look at the repack documentation. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2cd9c2a commit 13354f5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Documentation/git-clone.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,16 @@ These objects may be removed by normal git operations (such as 'git-commit')
7272
which automatically call `git gc --auto`. (See linkgit:git-gc[1].)
7373
If these objects are removed and were referenced by the cloned repository,
7474
then the cloned repository will become corrupt.
75-
76-
75+
+
76+
Note that running `git repack` without the `-l` option in a repository
77+
cloned with `-s` will copy objects from the source repository into a pack
78+
in the cloned repository, removing the disk space savings of `clone -s`.
79+
It is safe, however, to run `git gc`, which uses the `-l` option by
80+
default.
81+
+
82+
If you want to break the dependency of a repository cloned with `-s` on
83+
its source repository, you can simply run `git repack -a` to copy all
84+
objects from the source repository into a pack in the cloned repository.
7785

7886
--reference <repository>::
7987
If the reference repository is on the local machine

0 commit comments

Comments
 (0)