问题
I'm trying to estimate the storage requirements for my project on GitHub and have a few questions about how git-lfs stores multiple versions of files:
- Are multiple versions of files stored by git-lfs?
- If so, will every change to a file result in the complete file being replicated, or are only differences stored?
- Will all versions count towards the quota on github?
- Is there any way to control how many versions are kept?
回答1:
Answering your questions:
Are multiple versions of files stored by git-lfs?
Yes. All file versions are stored by git-lfs.
If so, will every change to a file result in the complete file being replicated, or are only differences stored?
Yes. Every little change results in a new complete file stored.
Will all versions count towards the quota on github?
Yes. Every time a new version is pushed, the total file size is counted against your quota.
Is there any way to control how many versions are kept?
No. Git LFS hasn't a feature to do that yet.
See more details here.
回答2:
Even with Git-LFS 2.0 (released two days ago, mainly locking and transfert queue), the general principle remains the same.
Nothing in the official LFS spec mentions delta storage: Each version counts in full, and as commented on issue 1101
Git LFS has no way to prune old objects from the server that are still referenced by git commits
So controlling how many versions are kept, or having some kind of rolling storage (where n+1 version get dropped), is still to be implemented.
This is going on the roadmap for this year, but I'm not sure when we'll get to it.
There are many questions around that type of feature:
- How would you, as a user, want to purge LFS objects?
- Would you purge a specific version of a file?
- Would you purge ALL versions of a file?
- Would you want to purge a range of versions? Maybe keep weekly checkpoints of active files or something.
- Do you want the ability to set policies on files, file types, or directories?
- Keep n versions of a file.
- Keep periodic (daily/weekly/monthly) checkpoints of files
- What would you expect Git LFS to do if it can't download a file that's been purged?
- Pointer file
- Nothing
- What would you expect Git LFS to do if it can't download a file due to some server issue?
- Halt current checkout/clone/pull command
- Pointer file
- Nothing
来源:https://stackoverflow.com/questions/42604978/multiple-file-versions-in-git-lfs