Personal tools

Auto clear temp. dir on pull

From PhotoVoltaic Logger new generation

Revision as of 13:04, 18 April 2014 by KKoPV (talk | contribs) (Created page with "If you cloned PVLng by git, you should clear the temp. directory after each <tt>git pull</tt>. To automate this, you can put the following code into <tt>.git/hooks/post-merge...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

If you cloned PVLng by git, you should clear the temp. directory after each git pull.

To automate this, you can put the following code into .git/hooks/post-merge:

#/bin/sh
#
# MIT © Knut Kohl - https://github.com/KKoPV
#
# Git hook to clear temp. directory after 'git pull'
#
echo
echo -n 'Empty temp. directory ... '
find tmp -type f ! -empty -delete
echo Done.

Make the script executable by

# chmod +x .git/hooks/post-merge

and you are done.

Next time, you pull changes from Github, the hook will remove all not empty files from temp. directory (this will ignore the .githold file)