Do you want git to send the resulting hook to make a new commit and click

I would like my post receiver to be responsible for updating the version file in the repo under certain conditions. So, suppose I have a version.txt file in my repository, I would like the message to get a hook to update the version line inside the version.txt file.

That would mean another push to the repo. Is it possible?

Thanks!

+4
source share
2 answers

I would prefer not to try to make any further commits / clicks, but to use the filter driver in the order, when checking / updating, in order to be able to create the correct content for this version.txt file (i.e. with the correct version of the line inside)

enter image description here

smudge script, if it is able to recognize the contents of the version.txt file (i.e. will not have the name / path of the specified file as a parameter ) will replace the template section of this file with the correct information.

+2
source

You may have a working directory for your repo on your server. In post-receive, git pull the working directory, update the version.txt file as needed and commit and click. This will cause post-reception again, so be careful how you perform your conditional update, otherwise it will go into a loop.

 #!/bin/sh unset GIT_DIR cd /path/to/repo.wd git pull echo "new content" > version.txt git add version.txt git commit -m "updating version.txt" git push origin master 
+2
source

All Articles