6

Consider the case where (for example) a 20GB directory is stored on a computer with 20.1GB disk space free, and we want to put this directory under revision control. A server is available to store revision history.

In subversion, we checkout an empty directory from the server, add the files, and commit it. This creates .svn directories of approximately the same size as the working directory so that it can detect changes and create diffs. The size of the .svn directories doesn't change over time as you make regular changes.

However, trying this in git (git init .; git add .; git commit) requires that we store the full history locally. As regular changes are made (assume large binary files that don't compress well), the .git directory grows until it doesn't fit on disk.

Is there a way to operate git so that it doesn't store the full history locally; so that it only keeps data about the tip of the branch that you're working on, and queries a remote server every time that it wants information about historical revisions or other branches?

note: I know the .git directory is better compressed and you can make lots of revisions before it gets bigger than the .svn directory - the issue is that it grows over time whereas the .svn doesn't

OJW
  • 4,514
  • 6
  • 40
  • 48
  • If you have a project with 20GiB of source code, the problem you are facing is not a technical one. You need to break the project up into smaller components. (Binary files do not belong in a VCS.) – William Pursell Jan 24 '13 at 13:04
  • 5
    Git isn't designed as a revision-controlled filesystem for arbitrary files? – OJW Jan 24 '13 at 13:07
  • 1
    It is indeed designed to hold arbitrary files. Choosing to store non-text files is, IMO, a mistake. There are other tools which are better suited for such files. – William Pursell Jan 24 '13 at 13:32
  • What tools are good for revision-controlled binary files? – OJW Jan 24 '13 at 13:49
  • 1
    I am not aware of any tools that are good for doing version control of binary files in the same sense that text files are version controlled. Storing binary files in a fashion that maintains consistent revisions is a different story. For executables, any decent package management system will do (eg dpkg, rpm, pkg). – William Pursell Jan 24 '13 at 13:57
  • I am indeed disappointed that this does not have an answer yet. I am facing the same problem: working with a limited amount of local storage. The fact that it is a distributed CVS cannot be overcome, I guess. But there must be some way of storing data in memory, for instance, or working with plumbing to not download everything before operating on it. Did you find any solution? – jjmerelo Feb 15 '15 at 08:37

2 Answers2

7

Depending on what you want to do, these answers might give you a clue Browse and display files in a git repo without cloning. In general, there are serveral solutions

  • Working with the remote copy if you have ssh access.
  • Using an access API such as the one provided by GitHub.
  • Using "shallow clone": git clone --depth=1
Community
  • 1
  • 1
jjmerelo
  • 22,578
  • 8
  • 40
  • 86
1

GIT is a Distributed CVS. The very heart of such DCVS is that they store their history locally.

You can't change that.

Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443