I try to find a solution to replace subversion with git in our
company. One of the requirements we have are extensive checks before a
commit can land in the main branch of the central server.

These tests include for example unit tests, code style and some
specific checks, which require a checked out version of the whole
tree. This tree also will be available through a web server for
functional tests.

Ideally what I want is this in the the update hook in refs/heads/
*,commit :

  cd /staging-area # previously cloned from the repo
  git fetch origin $newrev

This doesn't work though, because the $newrev is not yet committed.
Next version I had was:

  rm -frv /staging-area
  git clone --local --depth 1 /path/to/repo /staging-area
  git checkout -f $newrev

This seems to work, but is a bit slow because of the full clone and
the rather large repository. At the moment I am using the following:

  cd /staging-area # previously cloned from the repo with: git clone --
  git checkout -f $newrev

Which seems to work, but I am new to git and maybe I am doing
something completely wrong.

Is there a "right" way to do this?

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to