简体   繁体   中英

how can I create an archive before git svn dcommit?

I'm trying to create a zip archive of my project when I push to the svn server. My old setup would use a post-receive hook on the remote git repo to do this. However, I'm now using svn and I don't own the svn server so I can't put anything over there. I've set up the following pre-push hook but this isn't running on git svn dcommit :

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

Any ideas on which hook I could use?

Thanks!

You are using git-svn , right? You haven't cited it anywhere, so I'm not sure you are. Those git-hooks won't work with pure svn, you must be using git! It can be obvious, but better to be sure.

As to your problem, you could probably use a post-commit hook: once you finished a commit you zip things up. The downside to this, is that you won't have the zip file added to your repo.

If you need the zip on the repository, use the pre-commit hook and stash your tree. You can easily archive this tree, add the zipped file to the git index, and your done!

This answer might help you scripting this: Git archive of repository with uncommitted changes .

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM