Reputation: 359
I want to use Git to essentially just backup specific file types like .png and .jpg. So that there's never more than one copy of those files in my repo.
I imagine I could remove the files from Git and then recommit them every time, but I'd like to do that only when there's actually been a change in the file to avoid unecesssary copy time.
To describe my use-case: I use git with Xcode just to view changes of source files. I push to a cloud synced folder to have a backup of my project. I want to backup my resources like images in the same commit action, but not keep multiple copies/changes of them in my repo.
Upvotes: 0
Views: 405
Reputation: 1901
Large files and binaries should NOT be committed.
Git should be used for,
...easily storing changed to text files wherever you are, and then easily copying them up to a server or servers or sharing them with your friends locally. “Text files” is the key here. It easily lets you see textual changes. But this function is useless for binary data. Data about changes in binary files just makes the commits impossible to read.
And also,
It’s important to never commit binary files because once you’ve commit them they are in the repository history and are very annoying to remove. You can delete the files from the current version of the project - but they’ll remain in the repository history, meaning that the overall repository size will still be large.
Instead, you can use Git Large File Storage (LFS),
Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
Upvotes: 1