update local bare repository A after push from another repository B to remote C

守給你的承諾、 提交于 2019-12-12 04:38:40

问题


I cannot find any hook that is invoked from repository B (executes bash script on B) if I do a push from B to remote repo C. I want to take some action after push - I want to cd to another bare repo A on same machine as B is and do fetch from remote C. I can write a script wrapping git push, cd, git fetch but ideally I would like to execute cd, fetch from hook.

I am in B ( A and B are on same machine, I work in B and do push to remote C, A is tracking C so I want to cd into it and fetch/reset C into bare A)

executed in B repo:

#!bin/sh
git push
echo "updating A repository"
cd /A/project.git && git fetch origin master:master && git reset --soft

Can I put this code to some hook in B repository so it will be called automatically always after I do push to remote repository and remote repository is updated?

来源:https://stackoverflow.com/questions/22948575/update-local-bare-repository-a-after-push-from-another-repository-b-to-remote-c

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