Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge the content of files tracked by Git LFS

Tags:

git

git-lfs

I have an XML model (100 MB) in Git, that changes frequently and grows in size. I was considering using Git LFS to handle it.

By checking the documentation I am not sure if Git LFS supports the actual merge of the files, or when conflicts arise a "ours" or "theirs" approach should be followed.

Does Git LFS support the actual merge of the "real" content of the tracked files?

---- UPDATE 1----

I installed Git LFS on my computer, to track .xml files. Hence, the content of my XML model is no longer XML content, but a pointer to the Git LFS server. Here is how my XML file looks like now.

 version https://git-lfs.github.com/spec/v1
 oid sha256:0e23dcebda1977c424e5d0f25fda57d6eff9c2a5bbb6df7dd4985b64cf437d20
 size 53

Hence, if I change this XML file in two branches and try to merge, it raises a conflict. And when I open the XML file to resolve the conflict, I need to choose between one oid and the other:

<<<<<<< HEAD
oid sha256:0e23dcebda1977c424e5d0f25fda57d6eff9c2a5bbb6df7dd4985b64cf437d20
size 53
=======
oid sha256:cbe18ff9b73fad7d5b9cdcd177f9be9cf25bc88db279f3136aed5bfdec7eb0f7
size 91554569
>>>>>>> refs/heads/LFSbr1

---- UPDATE 2---

This is what I get when executing "git lfs env":

WARNING: Reading LFS config from ".gitconfig", not ".lfsconfig". Rename to    ".lfsconfig" before Git LFS v2.0 to remove this warning.
git-lfs/1.3.1 (GitHub; darwin amd64; go 1.6.3; git 9c9dffb)
git version 2.9.0

LocalWorkingDir=
LocalGitDir=
LocalGitStorageDir=
LocalMediaDir=lfs/objects
LocalReferenceDir=
TempDir=lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
BatchTransfer=true
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"

Anything wrong in it?

like image 554
letimome Avatar asked Jan 19 '17 21:01

letimome


People also ask

How do I merge files in GitHub?

Under your repository name, click Pull requests. In the "Pull Requests" list, click the pull request you'd like to merge. Depending on the merge options enabled for your repository, you can: Merge all of the commits into the base branch by clicking Merge pull request.

Does git LFS compress files?

Git LFS does not compress files. Some files are compressible, and some are not. It, like Git's partial clone feature, is designed to offload most of the data to a trusted server for the purposes of making local access lighter and cheaper.


1 Answers

Yes, it does. There's no difference related with the merge operation, between the LFS content and the non-LFS one. Git will manage the merge, not Git LFS.

I think the following line is missing in your "git lfs env":

git config filter.lfs.process = "git-lfs filter-process"

Be sure that your $HOME/.gitconfig has the following lines:

[filter "lfs"]
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
    process = git-lfs filter-process
    required = true
like image 71
Marcelo Ávila de Oliveira Avatar answered Sep 28 '22 11:09

Marcelo Ávila de Oliveira