如何在git svn dcommit之前创建存档?

时间:2013-12-19 19:00:01

标签: git svn githooks dcommit

当我推送到svn服务器时,我正在尝试创建项目的zip存档。我的旧设置将使用远程git仓库上的post-receive挂钩来执行此操作。但是,我现在正在使用svn,我没有svn服务器,所以我不能在那里放任何东西。我已经设置了以下预推钩,但这不在git svn dcommit上运行:

$cat .git/hooks/pre-push
#!/bin/sh
git archive -o foo_bar.zip --prefix foo_bar/ master

关于我可以使用哪个钩子的任何想法?

谢谢!

2 个答案:

答案 0 :(得分:2)

您正在使用git-svn,对吧?你没有在任何地方引用它,所以我不确定你是谁。那些git-hooks不适用于纯svn,你必须使用git!这很明显,但更好的确定。

至于你的问题,你可能会使用post-commit钩子:一旦你完成了提交,你就可以拉链了。这样做的缺点是,您不会将zip文件添加到您的仓库中。

如果您需要存储库中的zip,请使用pre-commit挂钩和stash树。您可以轻松归档此树,将压缩文件添加到git索引,然后完成!

这个答案可能会帮助您编写脚本:Git archive of repository with uncommitted changes

答案 1 :(得分:1)

由于没有这样的钩子,如何创建别名呢?

dcm = "!f(){ git archive -o foo_bar.zip --prefix foo_bar/ master; git svn dcommit; }; f"