Home > Software design >  Working on different projects in the same file with Github
Working on different projects in the same file with Github

Time:03-23

I have been trying to figure out the best way to logically handle this situation. I have a website and a staging version of it for testing new features/testing bug fixes. I find that I will often be working on multiple projects in the same files at the same time.

The problem is, say I am working in example.js on Project A. I get a good amount of it done, or maybe all of it done but it will take a while to test since it's a long project. In the meantime, I start working on Project B, which involves editing the same file, example.js. Project B is just a quick bug fix and it is ready to be uploaded to the live server. But how to I upload example.js to the live server with the Project B changes and without the Project A changes because Project A has not yet been fully tested?

I thought of using Github and just creating a different branch for every project that I'm doing and just pulling the Github repo down to the live server, but I can't put it together in my head. I'd be making these changes for all projects directly on the staging server so I can see them immediately on the staging version of the website.

If someone could help me put together a good process to go about this, it would be a big help.

CodePudding user response:

Using git (and probably github) is the way to go. The step you are missing is the git merge step. This means applying the changes you made in a branch (i.e. Project B) to the master branch which is the base for your deployment. You can then decide to upload it to your live server or even test it on your staging server and upload after that. When that is done, you upload your Project A branch to your staging server and work on that branch. And as soon as that branch is complete you git merge it into master.

There are many different patterns out there on how to layout your branches, but GitHib flow might be a good starting point.

  • Related