1

Assume you're developing a project that can save images uploaded by user. You're using some version controle system like github or bitbucket and store all user's files in

app.use(express.static(path.join(__dirname, 'public')));

To have some initial data you're put some files in public/upload folder. Than you push this to a remote repo, that uses your app server for deploying. Server uses this commands to get latest version of the app.

git fetch --all
git reset --hard

How to avoid overriding files in this 'public/upload' directory every time you're pushing new version of the app?

irisk
  • 111
  • 1
  • 9
  • use the .gitignore file – xShirase Dec 01 '16 at 10:21
  • @TimBiegeleisen having sample data in the upload folder, as OP describes, seems fine to me, I think he is trying to avoid the tires screeching case :) – xShirase Dec 01 '16 at 10:22
  • @xShirase A .gitignore file has no effect on remote git operations; it is only relevant when adding files to commit them. What i've need is to prevent fetching this files from remote repo. – irisk Dec 01 '16 at 10:30
  • then don't have them in the remote repo to begin with! git rm the files, then add the folder to gitignore – xShirase Dec 01 '16 at 10:32
  • http://stackoverflow.com/questions/1274057/how-to-make-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore found answer here. – irisk Dec 01 '16 at 10:33

0 Answers0