简体   繁体   English

使用git在Drupal网站上的分支之间切换

[英]Switching Between Branches On Drupal Website With git

So I'm working on a Drupal website and I want to start using git to play around with different ways of implementing functionality without destroying the old implementation (in case the new way turns out to be rubbish). 因此,我正在一个Drupal网站上工作,我想开始使用git尝试各种实现功能的方法,而又不破坏旧的实现(以防新方法变废为宝)。

Say I pull the master from the repository on the server (the same server with the Drupal installation on it) and then make a new branch, feature1, and then decide to make another branch from that called feature1b which is implemented differently. 假设我从服务器(与安装了Drupal的服务器相同)上的存储库中提取了主服务器,然后创建了一个新的分支Feature1,然后决定从另一种实现的分支Feature1b中创建另一个分支。 To test my code I need it to be on the server with the Drupal installation, so I would have to commit my branch back to master on the server. 为了测试我的代码,我需要将其安装在Drupal安装的服务器上,因此我必须将分支提交回服务器上的master。

What is the best way to push both branches to the server, without them being merged to master and being able to switch between them to test? 将两个分支都推送到服务器而不将它们合并到主服务器能够在它们之间切换以进行测试的最佳方法是什么?

what are you asking is: 您要问的是:

How to push changes to a new branch on remote server? 如何将更改推送到远程服务器上的新分支?

and the answer is: 答案是:

git push <your remote name> feature1

this will create branch feature1 on your remote (Drupal) server, then you can check it out and see how it works 这将在远程(Drupal)服务器上创建分支功能1,然后您可以将其检出并查看其工作方式

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

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