网站图像文件是否应该包含在GIT存储库中? [英] Should website image files be included in GIT repository?

查看:123
本文介绍了网站图像文件是否应该包含在GIT存储库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站文件/文件夹结构模板,可以使用 git 。它在 images 文件夹中包含一个空的 .gitignore 文件,这引出了我的两个部分问题:



1。)这个空的 .gitignore 文件会忽略位于里面的所有图像 images 文件夹,还是放在那里以允许在将之前的空文件夹添加到存储库任何图像放在里面?

2。)网站图片是否应包含在 git 存储库中我会对图像文件进行编辑和修改,就像其他文件一样,并且随着时间的推移跟踪所述更改将是有益的。

什么被认为是最佳实践?你做什么,为什么?

解决方案


  1. 在你的情况下,.gitignore允许git 看目录。它可以是任何其他文件。 Git不存储空文件夹。您必须将此行放入您的.gitignore才能忽略所有其他文件: !. gitignore

  2. 没有绝对回应但我建议您将图像与其他文件保存在存储库中。考虑你的git存储库作为你的版本网站,包括图片。如果您想要自动化您的部署,它将缓解您的负担。它会保持你的网站历史一致。 GIT像处理其他文件一样处理图像。


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?

解决方案

  1. In your case, the .gitignore allow git to "see" the directory. It could be any other file. Git doesn't store empty folder. You have to put this line into your .gitignore to tell to ignore all other files: !.gitignore
  2. There is no absolute response but I advise you to keep your images in the repository with the other files. Consider your git repository as your versionned website, images included. It will ease you if you want to automate your deployments. It will keep your website history consistent too. GIT handles images like any other files.

这篇关于网站图像文件是否应该包含在GIT存储库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆