简体   繁体   English

如何为我的wordpress网站使用git设置开发环境

[英]How to set up a development environment using git for my wordpress website

I am developing a wordpress website and it is live. 我正在开发一个wordpress网站,它是实时的。 I am currently using file-zilla to update my code. 我当前正在使用文件浏览器更新我的代码。 Until now I wasn't in need of any version control, but now it seems that I need to manage a repository as well. 到目前为止,我不需要任何版本控制,但是现在看来,我也需要管理存储库。 We have also added two freelancers in a development team. 我们还在开发团队中增加了两名自由职业者。 So, it becomes difficult for us to manage development of this website. 因此,对我们来说,管理这个网站的发展变得困难。

I have read several blogs and I came to a decision that I will use Git for version control. 我读过几个博客,然后决定使用Git进行版本控制。 However, I am struggling to find proper steps which explain to me about setting up a development environment for a team of freelancers. 但是,我正在努力寻找适当的步骤,这些步骤向我解释了如何为自由职业者团队建立开发环境。 Also, I got a little information about bitbucket, but I am not sure if that is necessary for me. 另外,我还获得了一些有关bitbucket的信息,但是我不确定这是否对我来说是必要的。 I am looking for the best answer to get started. 我正在寻找入门的最佳答案。

(Assuming you are leaving core Wordpress files alone and working only with themes and / or plugins as is best practice:) (假设您不保留核心的Wordpress文件,而是按照最佳实践仅使用主题和/或插件:)

Create a git repository every theme and plugin that you are working on using a server of your choice: I would go with Bitbucket for free private repos that you can invite the devs to. 使用您选择的服务器,为您正在使用的每个主题和插件创建一个git存储库:我将与Bitbucket一起使用免费的私有存储库,您可以邀请开发者加入。

Since you already have the files pushed by FileZilla, you would go into each of the folders for the themes and plugins you are using and push them as existing repos using SSH like so: 由于您已经拥有FileZilla推送的文件,因此您将进入使用主题和插件的每个文件夹,并使用SSH将其作为现有存储库推送,如下所示:

First initilize the repos and commit: 首先初始化仓库并提交:

$git init
$git add .
$git commit -a -m "initial commit"

Then push 然后推

$git remote add origin git@bitbucket.org:my_org/my_repo.git
$git push -u origin --all # pushes up the repo and its refs for the first time
$git push -u origin --tags # pushes up any tags

If you are editing core files as well which would be highly discouraged, then you would create just one repo for the entire Wordpress folder, and then initialize, add, commit and push as above. 如果您也极力劝阻您编辑核心文件,则只需为整个Wordpress文件夹创建一个存储库,然后如上所述进行初始化,添加,提交和推送。

Development environments would be set up by the devs themselves using the platforms of their choice. 开发环境将由开发人员自己使用他们选择的平台来设置。 Or ask them to use Vagrant if you want them to have similar environments. 或者,如果您希望他们具有类似的环境,请让他们使用Vagrant

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

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