I have a number of large video files which I don't want to push to my remote, I do however want to add them to my local repository. Kind of like a remote version of the .gitignore
file.
Is that possible?
To be more specific, I'm working on a multimedia project and one folder has project metadata files (it's a Screenflow project) as well as media. So it has a project.screenflow
folder with both .dat
files and Media\XXXX.aif
, Media\XXXX.mov
etc.
I want to share at least the project files (.dat
) with my team and it doesn't make sense to open the project up in Screenflow if you don't have the media it uses. However, there's a filesize limit of 100MB on our Git repo preventing me pushing those.
Currently, I've excluded Media
in the .gitignore
and may have to share the media by some other means :(
.gitignore
doesn't prevent you from having a file in your repository (you can always force it). So this is not really like a .gitignore
in the remote.
The immediate answer to your question is that it's not possible. Git keeps a history of your commits. Every commit is made (and hashed) by its contents. If you have a file in a commit, and you push that commit, you can't ask git to push only part of that commit, because then it wouldn't be the same commit anymore.
However, there are ways to achieve what you want, none of which are very clean. One example is with git submodules where you create a submodule that points to another local repo you have (with the video files). Anyone cloning your remote repo would not receive the video files, but they still see the submodule that refers to somewhere in your computer.
Another way would be to use git subtree to actually create another set of commits from the ones you have, excluding the videos, and then push those artificially made commits to your repository. It however imposes some directory structure.
The usual answer to such a question often is to rethink your repository. Are the videos vital to your repository? If not, then don't put them in the repository, neither local nor remote. Extra resources like that don't belong in a git repository (especially since they are also not versioned).
If you only want them in your local computer, by all means just keep them in some other directory. If you really want to have access to old versions, keep that other directory under git on its own. If you want others to see the files too, put them on a file sharing website.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments