git - 是否可以使用一个 git repo 并从两个不同的分支运行两个站点?
问题描述
我有一个项目,为此我设置了一个 git 存储库。我有两个与我合作的分支:主分支和开发分支。这都是在我的服务器上设置的。我想做的是从子域访问和测试我的开发分支,当一切正常时,合并到运行主站点的主站点。例如:
主分支:example.com
开发分支:dev.example.com
这可能吗?我的网站是一个在 Node 上运行的 Express 应用程序,我在 Ubuntu 20.04 服务器上使用 Nginx,主域和子域位于不同的服务器块上。任何正确方向的帮助或指示将不胜感激。
解决方案
是的,这很有可能。请参阅下面的 cmd。
$ cd /tmp
$ mkdir abc
$ cd abc
$ git init
Initialized empty Git repository in /tmp/abc/.git/
$ echo testing > README
$ git add README
$ git commit -m 'first commit'
[master (root-commit) e675a97] first commit
1 file changed, 1 insertion(+)
create mode 100644 README
$ cd ..
$ git clone abc def
Cloning into 'def'...
done.
$ cd def
$ ls
README
$
参考:https ://www.reddit.com/r/git/comments/5giehg/is_it_possible_to_have_a_remote_thats_on_the_same/
推荐阅读
- php - 将从 MySql 填充的下拉列表中选择的整行值插入到另一个 MySql 表中
- php - 如何在 Heroku 中使用 php imagecreatefromwebp 库
- forms - 访问 - 搜索两个相同的表结构
- javascript - javascript如何拆分并存储在数组中
- java - 在处理程序上调用时为空文本视图
- swift - 是否可以使用动态属性来保存跨兄弟类的重复排序代码?
- android - 无法在 GPU msm8953 上设置电压
- javascript - changedTouches:TouchList 不是属性?
- javascript - appendChild() 不接受传递的字符串参数作为参数?
- python - 检查python列表/numpy ndarray中是否存在重复项的最快方法