githooks

How do I properly git stash/pop in pre-commit hooks to get a clean working tree for tests?

穿精又带淫゛_ 提交于 2019-11-26 01:08:30
问题 I\'m trying to do a pre-commit hook with a bare run of unit tests and I want to make sure my working directory is clean. Compiling takes a long time so I want to take advantage of reusing compiled binaries whenever possible. My script follows examples I\'ve seen online: # Stash changes git stash -q --keep-index # Run tests ... # Restore changes git stash pop -q This causes problems though. Here\'s the repro: Add // Step 1 to a.java git add . Add // Step 2 to a.java git commit git stash -q -

Can Git hook scripts be managed along with the repository?

故事扮演 提交于 2019-11-26 00:45:45
问题 We\'d like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <project>/.git/hooks/ . However, those scripts are not propagated when people do a clone and they are not version controlled. Is there a good way to help everyone get the right hook scripts? Can I just make those hook scripts point to version controlled scripts in my repo? 回答1: Theoretically, you could create a hooks

Deploy a project using Git push

北慕城南 提交于 2019-11-25 23:09:57
问题 Is it possible to deploy a website using git push ? I have a hunch it has something to do with using git hooks to perform a git reset --hard on the server side, but how would I go about accomplishing this? 回答1: I found this script on this site and it seems to work quite well. Copy over your .git directory to your web server On your local copy, modify your .git/config file and add your web server as a remote: [remote "production"] url = username@webserver:/path/to/htdocs/.git On the server,

Can Git hook scripts be managed along with the repository?

拥有回忆 提交于 2019-11-25 18:40:59
We'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <project>/.git/hooks/ . However, those scripts are not propagated when people do a clone and they are not version controlled. Is there a good way to help everyone get the right hook scripts? Can I just make those hook scripts point to version controlled scripts in my repo? mipadi Theoretically, you could create a hooks directory (or whatever name you prefer) in your project directory with all the scripts, and then