Osvaldo Margato
Osvaldo Margato

Reputation: 35

How to ignore the content of folder without deleting when deploying via git

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.

Upvotes: 1

Views: 490

Answers (1)

VonC
VonC

Reputation: 1325337

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.

Upvotes: 3

Related Questions