git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Question on shallow clones.

From
APAlfred Perlstein <bright@mu.org>
Date
Feb 20, 2015, 14:13 UTC
Message-ID
<40B70861-177F-4239-A86F-49C92121ACE7@mu.org>
Hello,
Very sorry if this has been explained before, I have been doing research past few weeks in spare time and have not found a good answer yet on the safety of doing something with git.
Basically we have some repos with huge history, namely FreeBSD source and FreeBSD ports.  In order to reduce the space in $repo/.git as well as speed up clone time we were thinking of doing a shallow clone of the repo with something like --depth 5000.
I am wondering, if we such a thing, basically:

# get a shallow mirror of let's say 5000 entries git clone --depth 5000 --mirror our-freebsd.git smaller-freebsd.git # move our current repo to a backup mv our-freebsd.git our-freebsd.git.backup # make shallow repo our primary mv smaller-freebsd.git our-freebsd.git

Will we be able to push/pull from our "new" repo as if nothing happened?  Will hashes remain the same?
Can we in theory later do this:

# merge branches from the "github" remote and push back to "our-freebsd.git" git clone /url/our-freebsd.git our-freebsd.git cd our-freebsd.git git remote add github https://github.com/freebsd/freebsd.git git fetch github # get from our-freebsd git checkout -b master origin/master # now merge in freebsd changes git merge --no-ff github/master git push origin HEAD

Or will this break terribly?
Thank you very much.
-Alfred
Next: Duy Nguyen
Message 1 of 2 in “Question on shallow clones.”
  1. Alfred PerlsteinFeb 20, 2015
  2. Duy NguyenFeb 24, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.