How does Git deal with binary files?

后端 未结 4 1951
既然无缘
既然无缘 2020-12-24 11:17
  • Do I have to do something to tell Git whether some files are binary (like in Subversion)? Or, can Git handle binary data automatically?
  • If I change the binary
相关标签:
4条回答
  • 2020-12-24 12:03
    1. Git can usually detect binary files automatically.
    2. No, Git will attempt to store delta-based changesets if it's less expensive to (not always the case).
    3. Submodules are used if you want to reference other Git repositories within your project.
    0 讨论(0)
  • 2020-12-24 12:05
    git add my-binary-file
    git commit
    git push
    

    Will add your binary file; it is automatic.

    Indeed, if you have 100 versions of your file it will store it (but compressed).

    You can use submodules to make references to other repositories.

    0 讨论(0)
  • 2020-12-24 12:07

    Git uses a heuristic to try to determine if a file is a binary. See this article for more information and how to force git to treat a given file as a binary.

    For good tutorial on submodules see here and here.

    0 讨论(0)
  • 2020-12-24 12:21

    I had essentially the same problem: I wanted to git pickle files, which are binary, but git thinks they're text.

    I found this chapter on Git Attributes in the Pro Git Book. So I resolved my issues by creating a .gitattributes file with this line:

    *.pickle binary
    
    0 讨论(0)
提交回复
热议问题