If you need a file in a new clone or after clearing the git repository, you need to track it with git.
Binary files are not very similar. From you, the question sounds as if there is nothing to merge, but the solution is exactly the file that needs to be saved. One thing you can do is define custom auto-merge behavior for these binaries using the .gitattributes and .git / config options:
Add the following to your .gitattributes (or create a new file with this content in the root directory of your git repository)
path/to/file merge=nomerge
and put the following in the git config file (.git / config or ~ / .gitconfig)
[merge "nomerge"] name = keep current version driver = true
This indicates that git simply ignores the conflict and saves the file from the branch you are merging into. driver = true indicates the external program used for merging. In this case, the program is true , which must be available on any UNIX system and does nothing. See the gitattributes manpage section in Defining a custom merge driver to add real user logic if you need something smarter. On can do really complex things, such as always saving a higher version of a file if there is any version indicator in the file, for example.
You must git add save the .gitattributes file to the repository. The actual merge driver definition cannot be saved so that new clones automatically retrieve it from the window. Therefore, you need to add this manually to each clone or to the configuration of each user on each computer where you need it.
source share