0

My team all has a very large project (10s of gigs) we are working on. We currently all have the exact same state via a USB share, and would like to use git to track our changes without having to send all the base files to a remote server.

Is there a way to init and sync a git repository where the server does not have the full files, just the diffs/changes? Or are there alternative solutions anyone is aware of?

  • You can use Git without a server, too. – mkrieger1 Apr 15 '20 at 17:10
  • Maybe check https://stackoverflow.com/questions/12855926/how-to-handle-a-large-git-repository – mkrieger1 Apr 15 '20 at 17:12
  • The LFS and other extensions seem to focus on just tracking IF the file changed, but I want git to do it's normal HOW a file changed tracking, including allowing others to pull those changes, just without the server having the original file. – HelpHunter Apr 15 '20 at 17:20
  • @mkrieger1 For git without a server, what would be the method of syncing across systems? I've thought about maybe a solution where everyone has a local git repo and occasionally does a git diff, checks those diffs into another repo and everyone then pulls and applies the diffs. Might have tougher merge conflict resolution than a normal flow, but might also be the best approach? – HelpHunter Apr 15 '20 at 17:29
  • Then simple don't use Git, probably `quilt` is what you are looking for. – 0andriy Apr 15 '20 at 18:04
  • Git doesn't store changes. It stores files in full and calculates diffs. – phd Apr 15 '20 at 18:12
  • @0andriy the suggestion of `quilt` helped me come up with a solution to attempt. Since quilt doesn't seem to support directory diffing or recursion, I'm going to create local git repos on each machine, add everything, create a patches directory, make that a git repo that has a remote server. Then to share just changes, `git diff > patches/mychanges.diff`, then everyone pulls down from the patches repo and does a `git apply patches/mychanges.diff`. I think this should work for now. – HelpHunter Apr 15 '20 at 19:57

2 Answers2

1

No, you cannot have a Git repository that is metadata and diffs only. Git stores the entire contents of the repository. However, when the data is packed, it is stored very efficiently, so changes are effectively stored as differences against other files.

If your situation is that you'd like to have a smaller checkout or local copy, there are options like sparse checkout and partial clone. If your situation is that you don't want to use a server, you can store the data in a bare repository on a shared drive and pull from that. You can even send the data between yourselves via a set of email patches if you'd like.

But there is no way to not have at least one complete copy of the repository somewhere, whether that's on a server or on your machine.

bk2204
  • 64,793
  • 6
  • 84
  • 100
0

That's what the --bare option of init and clone does:

git init --bare

or

git clone --bare path-or-uri-of-the-original-repo
choroba
  • 231,213
  • 25
  • 204
  • 289