如何在Mercurial和Git中配置自动推送?有时我忘记推入一台计算机,当我移动我的位置时,我与好的代码不同步。例如,有没有办法让mercurial和git每小时都这样做呢?
发布于 2010-10-01 23:45:03
在mercurial中,你会把这个放到你的.hg/hgrc中
[hooks]
commit = hg push发布于 2010-10-01 21:16:32
使用git,您可以在每次提交后使用post-commit钩子进行推送。为此,您需要在.git/hooks目录中添加一个可执行的post-commit脚本。例如
#!/bin/sh
#
# An example hook script that is called after a successful
# commit is made.
#
# To enable this hook, rename this file to "post-commit".
git push --mirror remote 其中remote是指您要推送到的远程存储库的名称。
如果愿意,您还可以将cron设置为每小时执行一次此脚本。
更新
Mercurial也有钩子(当然)。这是relevant documentation。我没有用过Mercurial,所以你得自己解决。
https://stackoverflow.com/questions/3839439
复制相似问题