1

My git repository has certain max file size limit. My local repository has some big files. Is it possible to push only the files that do not exceed the file size limit? And if so, how to do it?

Is it necessary to make a separate commit with smaller files in order to push them or can I just use the commit that includes all the files (big and small)?

cerebrou
  • 5,353
  • 15
  • 48
  • 80
  • One thing to check is you've got a sufficiently strict `.gitignore` to prevent mistakes like this from happening by accident. – tadman Apr 25 '18 at 03:10
  • use `.gitignore`. see https://stackoverflow.com/questions/4035779/gitignore-by-file-size – Mazaher Bazari Apr 25 '18 at 03:16
  • 1
    `git push` pushes *commits*, not files. See my answer to a slightly-related question: https://stackoverflow.com/a/50007071/1256452 – torek Apr 25 '18 at 03:17

2 Answers2

0

Not to my knowledge (assuming that you want your repository to keep track of those files). Consider using Git Large File Storage, which will store your large files separately on some other server and only store references to those files in your repository (but when you check out a commit, any files it references will automatically be downloaded).

Aasmund Eldhuset
  • 37,289
  • 4
  • 68
  • 81
0

No git flags exist for limiting the file size. The following code accomplishes what you ask:

find * -size -4M -type f -print | xargs git add

For files with spaces use -print0 in find

Farid
  • 33
  • 9