GIT pre-reception

Is there a way to change the file that is being clicked on to the server using server-side pre-reception ?

Say I want to add something to the end of a file, for example:

//End of Org 

every time someone clicks on my repo.

Is there a way you can modify a file using git hooks ?

+6
git githooks
source share
2 answers

I would prefer to use a filter driver that can work with the contents of each file to check if your line is there and add it if not, during the verification step.

alt text

This will:

  • smudge script
  • can be replicated when cloning your repo (unlike hooks that are not copied when cloning a repo if you do not use the template directory )
+4
source share

Just for the sake of completeness: it should be pretty obvious from the name that what you are asking for is simply not possible. The pre-receive hook cannot modify files because it has not yet been received!

+3
source share

All Articles