简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM