You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to see a difference between subsequent versions of a file tracked by Git LFS, which I used to get using git log -p.
Is there an alternate command to get this difference with Git LFS? Are there any plans to integrate this command to display differences in file contents, rather than differences between pointer references, when using git diff or git log -p?
Note: I am using Git LFS to track (somewhat large) text files.
Reacted by Samuel Colvin, Matěj Laitl, Ruud van Asseldonk, Johan Klokkhammer Helsing, Radon8472 and Ian Thompson
Unless git lfs diff is a working command, I do not see how Git would have any knowledge of what the worktree values of the files are and therefore no mechanism to help you diff them.
Hey all, just going back through old issues that were never triaged. It's doubtful that we'll have a git lfs diff command that knows how to handle file types. But, LFS does add a diff=lfs to gitattributes, so there's potentially a way we could provide some way for custom diff tools to tie into LFS. I'm not sure how well that'd work on the command line though.
Is the git lfs diff feature available now. I am new to git and git lfs. I would like to have the diff to see the differences in the documents checked in to GIT LFS. Can someone pls suggest, how I can use the difftool command to achieve this. Where should this command be configured?
There is still no git lfs diff feature. You can use the git difftool command mentioned above with git diff --no-index to view files, or you can use git diff --no-index itself to diff two files on disk.
Another option if you want to have diffs is to run git config diff.lfs.textconv cat, which will have any files with the diff=lfs attribute automatically rendered through Git to show the LFS file instead of the pointer.
Reacted by Brandon Thayer, Paul Fleetwood, Jakob Rath, Jamie Cook, AnomalousUnderdog, Sonny, Flávio Juvenal, David Koerdt, Bernhard Schäfer, Jon Colverson and 45 more
Reacted by Lars Schneider, mx781, bb010g, David Nikel-Shepherd, Shaun Jackman, Oliver Pearmain, Alex Goodman, Bill, Lee, csymeonides-mf and 19 more
Reacted by Oliver Pearmain, Tomas Echeverri, Alex Goodman, Lee, Gannon Prudhomme, ArtistArthur, Richie Goulazian, fryd, Chris Watkins, Vadym Stupakov and 3 more
Hello! Im new to LFS I would like to know if files in LFS are treated the same as any other file in the repo? I mean, are only the differences saved or when I change the file does it get saved whole again?
so if I have a file of 10 MB and commit/push and then I change it and now its 20 MB, I commit/push again, is there 30 MBs now or 20 MB + the differences. I hope I made myself clear :p Thank you.
Hi @lestat, thanks for your question. In general, it's better to open a new issue than comment on one that's closed, unless it's directly related to your question.
In brief, no, LFS files are not treated identically to other files in the repo; that's sort of the crux of the issue. They are instead stored separately, and are not stored in the repo as deltas (diffs) against previous versions. There are lots of good tutorials out there, such as this one and the associated video, which might help explain some of the concepts.
Reacted by Daahrien, andreaswimmer and abdurrahmanarikan
git config diff.lfs.textconv cat was the fix that I was looking for! It's useful particularly for large text files in Git LFS, like e.g. JSON. Any thoughts on making adding that config by default after git lfs install?
git config diff.lfs.textconv cat was the fix that I was looking for! It's useful particularly for large text files in Git LFS, like e.g. JSON. Any thoughts on making adding that config by default after git lfs install?
Since a lot of the files that people store in Git LFS are binary files, such as images, I'm not sure that such an option would be a sensible default. I've documented it in the FAQ, though.
Reacted by Edmund, Soldeplata Saketos Candela, Douglas Diniz Carvalho and Hauke D
git config diff.lfs.textconv cat was the fix that I was looking for! It's useful particularly for large text files in Git LFS, like e.g. JSON. Any thoughts on making adding that config by default after git lfs install?
Since a lot of the files that people store in Git LFS are binary files, such as images, I'm not sure that such an option would be a sensible default. I've documented it in the FAQ, though.
Activity
whoisj commentedon Jun 25, 2015
Unless
git lfs diffis a working command, I do not see how Git would have any knowledge of what the worktree values of the files are and therefore no mechanism to help you diff them.eric-brechemier commentedon Jun 26, 2015
@whoisj my point exactly. I actually looked for a
git lfs diffcommand but could not find one:https://github.com/github/git-lfs/tree/master/docs/man
Are there any plans to develop this utility? How would it be done? Can I implement it myself (if noone has done it before) in the meantime?
michael-k commentedon Jun 26, 2015
Quick and dirty implementation to get diffs by hand: https://gist.github.com/michael-k/79d4282a6c8a9d1fb3a2
eric-brechemier commentedon Jul 1, 2015
@michael-k Excellent, thanks. I did not know that the LFS files were stored as plain text (for text files) inside the .git/lfs/objects folder.
If I understand correctly, the same method could be used to write a diff driver:
http://git-scm.com/docs/gitattributes#_defining_an_external_diff_driver
whoisj commentedon Jul 1, 2015
That is correct sir.
technoweenie commentedon May 10, 2016
Hey all, just going back through old issues that were never triaged. It's doubtful that we'll have a
git lfs diffcommand that knows how to handle file types. But, LFS does add adiff=lfsto gitattributes, so there's potentially a way we could provide some way for custom diff tools to tie into LFS. I'm not sure how well that'd work on the command line though.samuelcolvin commentedon Mar 14, 2017
This would be extremely useful. I've just started using lfs for large json files, it's pretty annoying I can no longer review changes with
git diff.I'm tempted to disable lfs until the files get so large I'm forced to use it.
biswajitind commentedon Sep 6, 2018
Interestingly if we use an external diff command, It works
Try this
git difftool -y --extcmd='/usr/bin/diff -c'
and in .gitattribute file have
*.json filter=lfs diff=lfs merge=lfs -text
ruuda commentedon Jan 4, 2019
We can even use Git's diff:
shuprash commentedon Jun 11, 2019
Is the git lfs diff feature available now. I am new to git and git lfs. I would like to have the diff to see the differences in the documents checked in to GIT LFS. Can someone pls suggest, how I can use the difftool command to achieve this. Where should this command be configured?
bk2204 commentedon Jun 11, 2019
There is still no
git lfs difffeature. You can use thegit difftoolcommand mentioned above withgit diff --no-indexto view files, or you can usegit diff --no-indexitself to diff two files on disk.bk2204 commentedon Jun 11, 2019
Another option if you want to have diffs is to run
git config diff.lfs.textconv cat, which will have any files with thediff=lfsattribute automatically rendered through Git to show the LFS file instead of the pointer.Daahrien commentedon Aug 7, 2020
Hello! Im new to LFS I would like to know if files in LFS are treated the same as any other file in the repo? I mean, are only the differences saved or when I change the file does it get saved whole again?
so if I have a file of 10 MB and commit/push and then I change it and now its 20 MB, I commit/push again, is there 30 MBs now or 20 MB + the differences. I hope I made myself clear :p Thank you.
chrisd8088 commentedon Aug 7, 2020
Hi @lestat, thanks for your question. In general, it's better to open a new issue than comment on one that's closed, unless it's directly related to your question.
In brief, no, LFS files are not treated identically to other files in the repo; that's sort of the crux of the issue. They are instead stored separately, and are not stored in the repo as deltas (diffs) against previous versions. There are lots of good tutorials out there, such as this one and the associated video, which might help explain some of the concepts.
sjackman commentedon Jan 15, 2021
git config diff.lfs.textconv catwas the fix that I was looking for! It's useful particularly for large text files in Git LFS, like e.g. JSON. Any thoughts on making adding that config by default aftergit lfs install?bk2204 commentedon Jan 15, 2021
Since a lot of the files that people store in Git LFS are binary files, such as images, I'm not sure that such an option would be a sensible default. I've documented it in the FAQ, though.
sjackman commentedon Jan 15, 2021
Makes sense. Thanks for updating the FAQ!
m27315 commentedon Jul 16, 2021
To address above concern, please see #4551.
Diff LFS file text, not pointers