1

I have a git repo already set up, but I want to create another remote repository/branch to only push the image files to (on Amazon S3 cdn). Subfolders containing images also need to be pushed.

Any ideas on how I can accomplish this?

I could have a .gitignore file that looks something like: * !/ !.jpg !*.png etc

But I'd have to swap it with the regular .gitignore file when pushing between origin/master and the new image remote. Maybe I could have a branch with its own .gitignore file, switch to that branch and push every time I want to update the image remote repository?

This question explains how to set up the repo, but not how to accomplish the image-only push to remote: Publish to S3 using Git?

Please let me know if you've any suggestions!

Community
  • 1
  • 1
Martok11
  • 261
  • 1
  • 4
  • 9

1 Answers1

0

Keeping aside the fact that binaries aren't the best fit for a distributed version control like git, I would recommend keeping them in their own git repo (that you can push as a all).

You current repo could reference those files with symlink (with relative path from one repo to the other).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • On git and binaries, see http://stackoverflow.com/questions/540535/managing-large-binary-files-with-git or http://stackoverflow.com/questions/4697216/is-git-good-with-binary – VonC Feb 28 '13 at 11:33
  • The images are generally small, less than 200kb, and are rarely modified once added to the repository so I'm not worried about using git with these binary files. It's also important that the images remain in the same working directories as the regular source code. I'd like to avoid creating a symlink every time we add a new image. – Martok11 Feb 28 '13 at 14:01
  • @Martok11 I would still recommend the symlink approach, when dealing with separate git repo. And a separate git repo is the easiest way to push "only a subset of files". – VonC Feb 28 '13 at 14:04