Prevent a checkout in Git

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.

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..

  • Why is my Git pre-commit hook not executable by default?
  • Maintaining development branches where one branch is a subset of another branch
  • Remove a single merged branch from master branch
  • How to merge the gerrit branch to another gerrit branch
  • Two git repos for the same files
  • Heroku application changes are deployed with a delay
  • 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.

    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?

  • git commit nolonger showing up in log
  • Elastic Beanstalk git aws.push issues
  • Pulling code from remote git branch, when it does not exist locally
  • Can a git submodule be created retroactively?
  • Prevent user from doing a commit before pulling latest changes
  • .npmrc file permission are not stored by git
  • One Solution collect form web for “Prevent a checkout in Git”

    I was also looking into this recently and found a thread discussing the current (well… 2010) state of githooks

    From the thread:

    Óscar Fuentes wrote:

    Because you can use your script in place of “git checkout”.

    Have you considered writing a script that developers can as part of their development workflow? That way you can check for the existence of the un-compiled changes list. This is basically what we ended up doing and it really helped us to simplify/standardize our workflow.

    Git Baby is a git and github fan, let's start git clone.