我使用git来跟踪一个项目,如果可能的话,我想设置一些东西,以便git处理我所有的代码分段,我可以有一个本地存储库用于测试,然后将更改推送到服务器用git让他们活下去。然而,在尝试使用标准的 git push 调用时,我最终会遇到不一致的分支以及可怕的历史冲突。有没有办法使用git来管理登台?
I'm using git to track a project, and if it's possible, I'd like to set things up so git handles all my code staging, I can have a local repository for testing, and then push changes to the server with git to make them live. However, in trying to use standard git push calls, I just end up with inconsistent branching and a terrible mess of conflicting histories. Is there a way to manage staging using git?
推荐答案您有这个
You have in this blog post an example of Git repo used for staging:
IDE => local Git repository => remote bare Git repository => Git repository with the live web application它涉及裸回购方面的更新后钩子,为了触发活动Web服务器端的回购更新。
It involves a post-update hook on the bare repo side, in order to trigger the update of the repo on the live web server side.
最后一步是定义更新后钩子裸仓库接收数据时调用该脚本。 要启用后更新钩子,我们必须使 hooks / post-update 可执行文件或重命名 hooks / post-update.sample 至 hooks / post-update 在这个脚本中,我们只需切换到实时应用程序的文件夹,然后启动pull操作:
The final step is to define the "post-update" hook script on the bare repository, which is called when the bare repository receives data. To enable the "post-update" hook, we have to either make hooks/post-update executable or rename hooks/post-update.sample to hooks/post-update, depending on the Git version. In this script, we simply change to the folder of the live application, and start the pull operation:
#!/bin/sh cd $HOME/example unset GIT_DIR git pull bare master exec git-update-server-info
有一个裸露的远程回购是因为它不鼓励用工作目录进行回购。
The reason there is a bare remote repo is because it is "discouraged" to do a push into a repo with a working directory.
更多推荐
我可以使用git让远程服务器保持最新状态吗?
发布评论