简体   繁体   English

是否可以创建一个作为主分支文件副本的分支进行测试?

[英]Is it possible to create a branch that is a copy of master branch files for testing?

Is it possible to create a testing branch, that is essentially a clone of the master branch, but for in-depth testing and debugging while users are using the live site?是否可以创建一个测试分支,它本质上是 master 分支的克隆,但用于在用户使用实时站点时进行深入测试和调试? Then, replace the old file with the updated one from the clone on the master branch when an update is ready to go live?然后,当更新准备好上线时,用来自主分支上的克隆的更新文件替换旧文件? Is there a better way to do this?有一个更好的方法吗?

Is it possible to create a testing branch, that is essentially a clone of the master branch, but for in-depth testing and debugging while users are using the live site是否可以创建一个测试分支,它本质上是 master 分支的克隆,但用于在用户使用实时站点时进行深入测试和调试

very simple:很简单:

git checkout master

git checkout -b <new branch>

Using git version > 2.5 you can always use git worktree add <second path> and you will have a copy working folder with the same code but in different folders.使用 git version > 2.5,您始终可以使用git worktree add <second path>并且您将拥有一个具有相同代码但位于不同文件夹中的副本工作文件夹。

checkout your project in another folder and make a branch.在另一个文件夹中签出您的项目并创建一个分支。 Configure your server to serve both folder.配置您的服务器以提供两个文件夹。 One for the "production", one for your test.一个用于“生产”,一个用于您的测试。

the good way is not to copy files.最好的方法是不要复制文件。 But to do a "git clone" in the project-test folder.但是要在 project-test 文件夹中执行“git clone”。 When done, do a "git branch -b myNewTestBranch" to create your new branch.完成后,执行“git branch -b myNewTestBranch”以创建新分支。 Configure your server to also use this folder.将您的服务器配置为也使用此文件夹。 Then do your tests.然后做你的测试。 When you think it's OK commit and push.当您认为可以提交并推送时。 Then go back on your master and merge it with your test branch.然后回到你的主人并将它与你的测试分支合并。 IMO this is the right way. IMO 这是正确的方法。 But if you work alone you can do what you've discribe but it's the "dirty way"但如果你一个人工作,你可以做你所描述的,但这是“肮脏的方式”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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