title: Prevent a checkout in Git
body: <p>I'm currently looking into managing source code from an OpenInsight application using Git. Because OI code is stored in a database table there is a certain amount of manual work to export the source to text and visa-versa.</p>
  
  <p>So far I have managed to automate a lot of this work using Git hooks, but the lack of a 'pre-checkout' hook has given me a problem.. </p>
  
  <p>When a user switches branches I have a post-checkout hook to diff the old and new branches and store a list of the changed procedures. When the user next starts OI the changes are pulled in from the text files and compiled.. so far so good.. However, if a user was to switch branches, let say from A to B, and then switch again to C without starting OI then the source in OI will be for branch A but the diff will be between B and C.</p>
  
  <p>To get around this I hoped to be able to use a pre-checkout hook to check for the existence of a file containing a list of un-compiled changes and stop the user switching branches until they were compiled in. Are there any other suggestions of ways of halting a checkout?</p>