Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: Remove files after push

Tags:

git

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).

like image 375
A123321 Avatar asked Sep 13 '26 19:09

A123321


1 Answers

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

like image 124
Alexandr Priymak Avatar answered Sep 15 '26 12:09

Alexandr Priymak