I have a website file/folder structure template to start using with git
. It contains an empty .gitignore
file inside the images
folder, which leads me to my two part question:
1.) Will this empty .gitignore
file ignore all the images located inside the images
folder, or was it placed there to allow the empty folder to be added to the repository before any images were placed inside?
2.) Should website images be included in a git
repository? To me, image files are edited and altered just the same as other files, and it would be beneficial to keep track of said changes over time.
What is considered best practice? What do you do, and why?
TLDR: if you can, use git-lfs to store images or other binary files in git.
Upload images to GitHub. Create a new issue on GitHub. Drag an image into the comment field. Wait for the upload process to finish.
Raster images and music files make as much sense to Git as they would to you if you looked at the binary data contained in a . png or . wav file. So Git just takes all the data and makes a new copy of it, even if only one pixel changes from one photo to the next.
You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.
!.gitignore
Check out 'setup with binaries' and specifically 'git media' and 'git annex'. But, it is perfectly fine to use GIT directly with image files with one caveat - if you try 'git rebase' there can be a crash when comparing two large images.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With