Git and media directory commits

53 Views Asked by At

I've just started using Envoyer with Bitbucket and one problem I have with a live project is the media directory to which users of the system upload different media. If I exclude it from the commits, then they will effectively be removed from the live project on deployment - if I keep them - then they will overwrite the existing ones. What is the approach for this sort of situation, where you only want to commit them first time and then ignore on each sub-sequent deployment?

1

There are 1 best solutions below

1
On

You can add .gitignore to the media directory:

# Ignore everything in this directory
*
# Except this file
!.gitignore