1

My project has a folder called 'images', its content depends on user uploads, so the content from the development environment is different of the production one.

When a commit is merged and deployed to the host via git, it automatically deletes all the content in the production. I tried using .gitignore with images/* to ignore all the content, but the git interpreters as if the content was deleted.

  • Putting images in .gitignore seems to be the way to go. You want git to think the folder has been deleted because you don't want git to believe the folder even exists. Is there a reason why you don't want it to be "deleted"? – Bennett Hardwick Feb 17 '19 at 01:58
  • While I see you tired modifying the gitignore, are you using the correct gitignore file for your projcet? If not, it could cause problems (maybe). There are different one's you can get from github specifically for different languages. Sorry if this is too simple. Just to gain more info about your problem, is it deleting the folder itself, or the content of the folder? – geekTechnique Feb 17 '19 at 01:59
  • Sorry if I was unclear. This folder includes the profile pictures of the users, so the folder content is different in each environment. When I put the images in .gitignore, the deploy understands as if I deleted of the repo and deletes from production as well. – Osvaldo Margato Feb 17 '19 at 02:50

1 Answers1

3

its content depends on user uploads

That is a runtime data, no a source code base element.

In your source code, you should record image as a symlink (stored in a Git repository as a blob with a path to an external folder)

That way:

  • image has no merge problem
  • the external path to the actual image/ folder content is not impacted by the Git repository being merged or checked out.
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250