Reputation: 837
I have a local repository at my workstation and remote repository on server (phpfog.com). My application generates cache files and I want to delete them (on the remote) everytime someone pushes: is it possible and if so - how? FYI: These files are ignored using .gitignore (maybe there might be a way how to use this).
I've heard of git hooks but have little idea how to use them.
Thank you
Edit: I want to do git clean (remove untracked files) but on the remote and with every push. These files are generated by application and this cannot be solved by .gitignore-ing them (in fact they are gitignored).
Upvotes: 3
Views: 2049
Reputation: 1581
I think post-receive hook is what you are looking for.
Just add a bash script to remote server which clean all cache file and specify it as post-receive hook. For more information look at http://book.git-scm.com/5_git_hooks.html
Upvotes: 4
Reputation: 301167
Why are people pushing files that are better ignored? Just git rm --cached
them and commit and push. Make sure they are properly added to the .gitignore
and it would make sure people are not accidentally adding these files again and pushing them.
Upvotes: 1