Git 生产和开发服务器工作流程
Git production and development server workflow
我不确定我打算在我的生产和开发服务器之间创建的 git 工作流是否是正确的方法。
这就是我的想法:开发在本地计算机上进行,提交 git push
到开发服务器。一旦稳定版本可用,生产服务器就会从开发服务器执行 git pull
。任何意外的生产结果都可以使用 git revert
恢复
这是正确的做法吗?如果是这样,我如何将现有代码放在开发服务器上,一个远程仓库?据推测,它对生产和本地都是远程的,因为它们 pull
和 push
.
Is it the correct way of doing this?
是的,听起来完全有道理。
If so, how do I make existing
code sitting on the development server, a remote repo? Presumably,
it's remote to both production and local as they pull and push.
假设您通常通过 ssh 访问您的存储库,如下所示:
brian@local$ ssh brian@development
brian@development$ cd /home/brian/code
brian@development$ git status
然后您可以使用 git clone ssh://brian@development:/home/brian/code
克隆此代码。从那时起,您应该能够 git push
和 git pull
往返开发。
Is it the correct way of doing this? If so, how do I make existing code sitting on the development server, a remote repo? Presumably, it's remote to both production and local as they pull
and push
.
Git只是一个工具,没有任何正确的方式或如何使用它正确的方法.
您的情况:
- 有 3 个服务器(或说 3 个 git 存储库)
- 本地 --push-to--> 开发
- 生产<--拉动--开发
因此您可以先构建开发 git 存储库,然后克隆到生产和本地:
user@development $ setup_git_repo.sh
user@local $ git clone ssh://user@development:/path/to/git/repo
user@production $ git clone ssh://user@development:/path/to/git/repo
或者您可以通过 http:
进行克隆
user@development $ setup_git_repo.sh
user@local $ git clone http://development.server/git/repo
user@production $ git clone http://production.server/git/repo
那么你有 3 个 git 存储库。本地 git 存储库和生产 git 存储库是从开发 git 存储库中克隆的。
最后,你可以在本地进行日常编码并推向开发。
使用新标签对开发和发布进行一些测试。
运行 git pull
在生产服务器上获取最新代码。
我不确定我打算在我的生产和开发服务器之间创建的 git 工作流是否是正确的方法。
这就是我的想法:开发在本地计算机上进行,提交 git push
到开发服务器。一旦稳定版本可用,生产服务器就会从开发服务器执行 git pull
。任何意外的生产结果都可以使用 git revert
这是正确的做法吗?如果是这样,我如何将现有代码放在开发服务器上,一个远程仓库?据推测,它对生产和本地都是远程的,因为它们 pull
和 push
.
Is it the correct way of doing this?
是的,听起来完全有道理。
If so, how do I make existing code sitting on the development server, a remote repo? Presumably, it's remote to both production and local as they pull and push.
假设您通常通过 ssh 访问您的存储库,如下所示:
brian@local$ ssh brian@development
brian@development$ cd /home/brian/code
brian@development$ git status
然后您可以使用 git clone ssh://brian@development:/home/brian/code
克隆此代码。从那时起,您应该能够 git push
和 git pull
往返开发。
Is it the correct way of doing this? If so, how do I make existing code sitting on the development server, a remote repo? Presumably, it's remote to both production and local as they
pull
andpush
.
Git只是一个工具,没有任何正确的方式或如何使用它正确的方法.
您的情况:
- 有 3 个服务器(或说 3 个 git 存储库)
- 本地 --push-to--> 开发
- 生产<--拉动--开发
因此您可以先构建开发 git 存储库,然后克隆到生产和本地:
user@development $ setup_git_repo.sh
user@local $ git clone ssh://user@development:/path/to/git/repo
user@production $ git clone ssh://user@development:/path/to/git/repo
或者您可以通过 http:
进行克隆user@development $ setup_git_repo.sh
user@local $ git clone http://development.server/git/repo
user@production $ git clone http://production.server/git/repo
那么你有 3 个 git 存储库。本地 git 存储库和生产 git 存储库是从开发 git 存储库中克隆的。
最后,你可以在本地进行日常编码并推向开发。
使用新标签对开发和发布进行一些测试。
运行 git pull
在生产服务器上获取最新代码。