title: How to put a folder which has large files (.avi and .pdf) as well as source files (.py, .m) in multiple directories under git source control?
body: <p>I have a large folder of ~ 4 GB. This folder has python source code, Matlab source code, a lot ~50-80 MB video files as well as pdf files. I was originally planning to put them all under .git source control and put them in github, but I found that it made everything really slow. Further, github started complaining that I am using too much of their bandwidth.</p>
  
  <p>I am thinking that a better approach would be to keep the .avi or other large files in the similar structure, but to only put the source files under git control by adding the lines </p>
  
  <pre><code>*.avi
  *.pdf
  *.mp4
  !*.py
  !*.m
  </code></pre>
  
  <p>The above line will not put .avi, .pdf and .mp4 files under source control, but always put .py and .m files under source control. </p>
  
  <p>The .pdf, .mp4 files are important, but I just don’t want to upload to github. I would also want to change or checkout differenct branches of the repository at certain times in future. </p>
  
  <h1> Questions </h1>
  
  <ol>
  <li>Say I have a folder now called videos under a certain subdirectory such as </li>
  </ol>
  
  <p>Videos/
           Oop.avi</p>
  
  <p>Say the previous version of the folder doesn’t have this. <strong>Will the Videos directory be completely overwritten if I checkout the previous branch?</strong></p>
  
  <p>I am sure there will be other permutations and combinations of the above scenario which might happen.</p>
  
  <ol start="2">
  <li><strong>What is the best practice for such cases, when the large files are mixed in with source files in various directories?</strong> But you don’t want to necessarily share the large files, but don’t want to lose them either, if you checkout a previous branch which didn’t have the large files.</li>
  </ol>