Git LFS 2.5.0 is now available
Git LFS 2.5.0 comes with three new migration modes, a handful of bug fixes, and more.
A new version of Git LFS, the open-source Git extension for versioning large files, is now available. Git LFS v2.5.0 comes with three new migration modes, a handful of bug fixes, and more.
New migration modes
With v2.5.0, you can use the git lfs migrate
command in a few new ways.
Sometimes repositories can get into a broken state when large files that should have been committed with Git LFS aren’t. If your file is over 100 MB, you won’t be able to push to GitHub, and your history will require rewriting with git lfs migrate import
. If you have a file smaller than 100 MB, you can use git lfs migrate import --no-rewrite
to create new commits that move the file to Git LFS, allowing you to repair the state of your repository more easily than ever.
If you have committed a handful of files that should have been stored with Git LFS, but aren’t, you can let Git LFS determine the affected files for you by running git lfs migrate import --fixup
. The --fixup
flag automatically reads .gitattributes
file(s) in your repository, and converts Git objects that should be stored with Git LFS automatically:
In the following example, notice how our .gitattributes file says that *.png
‘s should be tracked using Git LFS, but we added mona.png without Git LFS:
$ cat .gitattributes
*.png filter=lfs diff=lfs merge=lfs -text
$ git cat-file -p :mona.png | file -s
/dev/stdin: PNG image data, 896 x 896, 8-bit/color RGBA, non-interlaced
We can easily fix this without having to tell Git LFS which files to start tracking:
$ git lfs migrate import --fixup
migrate: Fetching remote refs: ..., done
migrate: Sorting commits: ..., done
migrate: Rewriting commits: 100% (2/2), done
master 1002728154804338fe645976ad8b7258b0be0810 -> 076e2bfe114df5575b1130f694c18d1b26c86b86
migrate: Updating refs: ..., done
migrate: checkout: ..., done
$ git cat-file -p :mona.png
version https://git-lfs.github.com/spec/v1
oid sha256:49afbfc61b10df78377f8f7dac774158e1a0197740e160ea3572d9839c61ac04
size 106277
Now mona.png is stored correctly using Git LFS!
Lastly, if you want to stop using Git LFS and export your large objects, you can use git lfs migrate export
. It accepts the same arguments as git lfs migrate import
, and easily allows you to take files out of Git LFS.
Developer ergonomics
We have updated several of the scripts and programs used to develop and hack on Git LFS to feel more familiar to open source contributors. The test suite now outputs results using the TAP format, enabling it to be run with prove
. Similarly, the project can now be built using a Makefile
, which should feel more familiar to developers comfortable working with Git.
Additional updates
You’ll see a handful of other new features and bug fixes in v2.5.0 like improved support for object alternates, correct git lfs status
output from subdirectories, and more.
For instructions on configuring Git LFS, refer to this article.
Tags:
Written by
Related posts
What the EU’s new software legislation means for developers
The EU Cyber Resilience Act will introduce new cybersecurity requirements for software released in the EU. Learn what it means for your open source projects and what GitHub is doing to ensure the law will be a net win for open source maintainers.
Game Off 2024 theme announcement
GitHub’s annual month-long game jam, where creativity knows no limits! Throughout November, dive into your favorite game engines, libraries, and programming languages to bring your wildest game ideas to life. Whether you’re a seasoned dev or just getting started, it’s all about having fun and making something awesome!
Highlights from Git 2.47
Git 2.47 is here, with features like incremental multi-pack indexes and more. Check out our coverage of some of the highlights here.