Skip to content

Commit

Permalink
provide an update script
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Sep 7, 2013
1 parent 04bf060 commit a67db05
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,23 @@ If you want to enable a plugin on every project, use the `--global` option:

git config --global --add hooks.enabled-plugins some_plugin

## Updating

To get updates you need to update your template directory first :

# Go to your template directory (probably ~/.git_template)
eval cd $(git config --get init.templatedir)
git pull

Then, you can update any repository by running this in the working tree of your
repository :

eval $(git config --get init.templatedir)/update.sh
# If your template directory is ~/.git_template, this is equivalent to :
~/.git_template/update.sh

Make sure you have rsync installed.

## Contributing

Creating your php plugin is as easy as creating a php folder under `hooks/php`.
Expand Down
13 changes: 13 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash -eu
readonly PROGDIR=$(readlink -m $(dirname $0))
main()
{
# eval is needed to expand ~ to the home directory
eval local templateDir=$(git config --get init.templatedir)
if [ ! -d .git ]
then
echo "This script is supposed to be run at the root of a git repository" >&2
fi
rsync -avzC --exclude="update.sh" $PROGDIR .git --delete
}
main

0 comments on commit a67db05

Please sign in to comment.