Git: Auto commit contents of a windows folder

孤街浪徒 提交于 2019-12-13 00:58:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!