admin管理员组

文章数量:1122832

The Situation

I am working on a plugin only. Currently I am the only user, but it is currently in the WordPress approval queue, so I hope to find a userbase for it. While most articles I find recommend working on a local server, I prefer to work on a remote one. This is because I work across 4 different computers, including one in a heavily locked down environment where nothing can be installed locally but my online editor works. At present I am the only developer, but I hope to have help from one or two others in future. At the moment I work on a remote host (let's call it Dev), when I'm ready to test a feature I zip (or Archive in siteground terms) my plugin folder and download it. I have a second remote host (let's call it Test) with a plain vanilla WP setup on it. On the Test env I create a staging copy for my testing, and install my plugin zip on it using the WP Admin GUI. If that works as expected I then test on a staging copy of my production site, which includes WooCommerce and a number of other plugins to check that my plugin is playing nicely on a more complex WP environment. The plugin will then be installed on my Production site for dog-fooding, before I would consider releasing an updated version more widely. I am planning to sell a premium version of my plugin through Freemius, so before the update can be distributed the plugin will need to be loaded into Freemius for the free and premium versions to be generated.

It is also worth mentioning that as a hobby project I sometimes get diverted by new feature ideas that may not be the highest priority, but interest me at that time. As a result there will sometimes be branches of the code that I am playing with. These will typically be hosted on additional staging copies of the Dev or Test environments. While I used to be a software developer professionally, by the time git was used on my teams I was managing them rather than actively coding. So I am not always clear on the right git "verbs" to use for each situation. If it makes any difference, my host is Siteground, I have ssh to the hosts, and git is installed on them. I am currently storing my bug and feature list on github.

The Problem

No source control. Which pains me. I need to integrate git into this process. Especially because I'm hoping to work with other developers in future, and because of my habit of branching off developments. It would also be nice to have the ability to integrate some tests and other build steps into the workflow, but the lack of source control is the most pressing issue.

My Proposed Solution

I have ssh acces to my hosts. One option I am considering is to have my main repo on github. When I want to do some development work I would branch the github trunk and name the branch after the environment where the development is being performed. I could then clone that branch to the host. Once the feature is ready I can add / commit the changes to the branch on the host then push to github. After testing the branch can be merged back to trunk on github. Production releases would be taken from the github trunk.

The Questions

Does my proposed workflow work? I'm concerned I may be misunderstanding something fundamental about how git operates. For example if I have multiple staging environments on a host, will it be ok to have multiple clones of my github trunk on the server?

Git is installed on the servers, but if I use it locally I would get the benefit of using git GUI for merging etc, and I am generally more comfortable in GUI based environments than on the command line. Do you think I would be better off using git locally rather than on the hosts?

If this workflow does work, how would I refresh an environment from the trunk? Would it be better to create a new branch and clone it to the environment again, or merge the trunk into the existing branch then pull it to the repo on the host?

The Situation

I am working on a plugin only. Currently I am the only user, but it is currently in the WordPress.org approval queue, so I hope to find a userbase for it. While most articles I find recommend working on a local server, I prefer to work on a remote one. This is because I work across 4 different computers, including one in a heavily locked down environment where nothing can be installed locally but my online editor works. At present I am the only developer, but I hope to have help from one or two others in future. At the moment I work on a remote host (let's call it Dev), when I'm ready to test a feature I zip (or Archive in siteground terms) my plugin folder and download it. I have a second remote host (let's call it Test) with a plain vanilla WP setup on it. On the Test env I create a staging copy for my testing, and install my plugin zip on it using the WP Admin GUI. If that works as expected I then test on a staging copy of my production site, which includes WooCommerce and a number of other plugins to check that my plugin is playing nicely on a more complex WP environment. The plugin will then be installed on my Production site for dog-fooding, before I would consider releasing an updated version more widely. I am planning to sell a premium version of my plugin through Freemius, so before the update can be distributed the plugin will need to be loaded into Freemius for the free and premium versions to be generated.

It is also worth mentioning that as a hobby project I sometimes get diverted by new feature ideas that may not be the highest priority, but interest me at that time. As a result there will sometimes be branches of the code that I am playing with. These will typically be hosted on additional staging copies of the Dev or Test environments. While I used to be a software developer professionally, by the time git was used on my teams I was managing them rather than actively coding. So I am not always clear on the right git "verbs" to use for each situation. If it makes any difference, my host is Siteground, I have ssh to the hosts, and git is installed on them. I am currently storing my bug and feature list on github.

The Problem

No source control. Which pains me. I need to integrate git into this process. Especially because I'm hoping to work with other developers in future, and because of my habit of branching off developments. It would also be nice to have the ability to integrate some tests and other build steps into the workflow, but the lack of source control is the most pressing issue.

My Proposed Solution

I have ssh acces to my hosts. One option I am considering is to have my main repo on github. When I want to do some development work I would branch the github trunk and name the branch after the environment where the development is being performed. I could then clone that branch to the host. Once the feature is ready I can add / commit the changes to the branch on the host then push to github. After testing the branch can be merged back to trunk on github. Production releases would be taken from the github trunk.

The Questions

Does my proposed workflow work? I'm concerned I may be misunderstanding something fundamental about how git operates. For example if I have multiple staging environments on a host, will it be ok to have multiple clones of my github trunk on the server?

Git is installed on the servers, but if I use it locally I would get the benefit of using git GUI for merging etc, and I am generally more comfortable in GUI based environments than on the command line. Do you think I would be better off using git locally rather than on the hosts?

If this workflow does work, how would I refresh an environment from the trunk? Would it be better to create a new branch and clone it to the environment again, or merge the trunk into the existing branch then pull it to the repo on the host?

Share Improve this question asked Aug 1, 2024 at 10:55 zcesl53zcesl53 354 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Does my proposed workflow work?

That's up to you but it seems overly complex to me. I would do all the work locally in my own desktop using some kind of tool like wp-env or raw docker and just think about servers when it is time to approve the final work and to deploy on production.

For example if I have multiple staging environments on a host, will it be ok to have multiple clones of my github trunk on the server?

On the git terminology, we don't say trunk, we say main branch. And you can clone any of the branches of your repository wherever you want to. Yes, you can have 10 different directories with clones of the same repository if you want to.

If this workflow does work, how would I refresh an environment from the trunk?

With git pull or git fetch.

Would it be better to create a new branch and clone it to the environment again, or merge the trunk into the existing branch then pull it to the repo on the host?

I don't really understand your question but I think that you are probably missing some important knowledge about how a development environment use to work and also how to properly use git. I suggest you to do the basics first. I advise you to follow this git tutorial and to take a look at the github flow.

Do some research on development workflow. There are many different proposals and people like to blog about it.It may help you. There are lots of different WordPress development workflow out there. For plugin development i personally like to work with wp-env but there are many others like the old LocalWP. There are many other tools for this besides those two.

If you plan to work directly on a server. You really should learn to properly use git at least.

本文标签: How should I integrate git into my Wordpress workflow when I39m working on remote hosts