问题
We have a shared folder on our network. Is there a way to auto commit and push the changes of the folder (say every hour) to the remote Stash repository? Thanks.
回答1:
There's a bunch of opensource tools to do git autocommit. However, they solve a slightly different task: making a commit just after a change is detected.
https://github.com/mvgrimes/git-autocommit
https://github.com/riddochc/git-autocommit
Also, you can make a batch file and schedule it to run each hour:
#!/bin/sh
cd path/to/your/project
git add --all
timestamp() {
date +"at %H:%M:%S on %d/%m/%Y"
}
git commit -am "Regular auto-commit $(timestamp)"
git push
If anyone knows how to insert a timestamp in batch file, you're welcome to edit this answer.
回答2:
You can do it if you convert the folder to a git project and then by adding hooks it can do what ever you want on every commit and or push that was made.
If its not a git repository you will need some other third party to handle it for you.
来源:https://stackoverflow.com/questions/30310347/git-auto-commit-contents-of-a-windows-folder