Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do Git LFS and git-annex differ?

git-annex has been around for quite some time, but never really gained momentum.
Git LFS is rather young and is already supported by GitHub, Bitbucket and GitLab.

Both tools handle binary files in git repositories. On the other hand, GitLab seems to have replaced git-annex with Git LFS within one year.

  • What are the technical differences?
  • Do they solve the same problem?
like image 847
Stefanus Avatar asked Sep 05 '16 20:09

Stefanus


People also ask

What is the difference between git and git LFS?

Git LFS is a Git extension used to manage large files and binary files in a separate Git repository. Most projects today have both code and binary assets. And storing large binary files in Git repositories can be a bottleneck for Git users. That's why some Git users add Git Large File Storage (LFS).

Does git LFS reduce repo size?

Unfortunately, unless you rewrite history and purge those files, the repo size will not shrink. The reason being that the files are still in commit history, even if they are deleted from HEAD.

What is migrate LFS git?

A common use case for the migrate command is to convert large Git objects to LFS before pushing your commits. By default, it only scans commits that don't exist on any remote, so long as the repository is non-bare.


2 Answers

They do solve the same problem.

Let me start off with pro/con, then I'll move into technical differences.

git-annex

Pros:

  • Supports multiple remotes that you can store the binaries.
  • Can be used without support from hosting provider (for more details see here).

Cons:

  • Windows support in beta, and has been for a long time
  • Users need to learn separate commands for day-to-day work
  • not supported by github and bitbucket

git-lfs

Pros:

  • Supported by github, bitbucket and gitlab
  • Most supported on all os's
  • Easy to use.
  • automated based on filters

Cons:

  • Requires a custom server implementation to work. A simple ssh remote is not sufficient. Reference server is under development https://github.com/git-lfs/lfs-test-server.

Technical

git-annex

git-annex works by creating a symlink in your repo that gets committed. The actual data gets stored into a separate backend (S3, rsync, and MANY others). It is written in haskell. Since it uses symlinks, windows users are forced to use annex in a much different manner, which makes the learning curve higher.

git-lfs

Pointer files are written. A git-lfs api is used to write the BLOBs to lfs. A special LFS server is required due to this. Git lfs uses filters so you only have to set up lfs once, and again when you want to specify which types of files you want to push to lfs.

like image 126
grepsedawk Avatar answered Sep 28 '22 00:09

grepsedawk


A major advantage of git annex is that you can choose which file you want to download.

You still know which files are available thanks to the symlinks.

For example suppose that you have a directory full of ISO files. You can list the files, then decide which one you want to download by typing: git annex get my_file.

Another advantage is that the files are not duplicated in your checkout. With LFS, lfs files are present as git objects both in .git/lfs/objects and in your working repository. So If you have 20 GB of LFS files, you need 40 GB on your disk. While with git annex, files are symlinked so in this case only 20 GB is required.

like image 45
Karl Forner Avatar answered Sep 28 '22 01:09

Karl Forner