Skip to content

Instantly share code, notes, and snippets.

@blkperl
Created June 4, 2012 22:45
Show Gist options
  • Save blkperl/2871290 to your computer and use it in GitHub Desktop.
Save blkperl/2871290 to your computer and use it in GitHub Desktop.
#!/bin/sh
cd $HOME/supernexus
branch="PECVD_Master"
lock="/tmp/githooklock"
if mkdir $lock; then
echo "Locking nexus superproject succeeded" >&2
else
echo "Locking nexus superproject failed - exit" >&2
exit 1
fi
# Track latest changes to submodules
git submodule sync
git submodule foreach --recursive "git clean -d -x -f"
git submodule foreach --recursive "git checkout $branch"
git submodule foreach --recursive "git fetch origin $branch"
git submodule foreach --recursive "git reset --hard origin/$branch"
if [ "`git status | wc -l`" -eq "2" ]; then
echo "No Changes for nexus superproject"
else
echo "Pushing changes to nexus superproject on $branch"
git commit -a -m "hook: Track latest changes to nexus"
git push origin $branch
fi
wait
rmdir $lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment