Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Question about git workflow

Hi everybody, I'm trying to bring myself to use git to develop my web apps, I develop alone since I'm still learning. I was wondering if this workflow would be a good start for me. Basically I have the master branch, this would be also called the production branch were only safe and working code resides, then I could have a develop branch, this branch is were I do all my day to day work, on this branch I could be adding new features, fixes, everything as branches and I guess this new branches off develop could be merged with master? or maybe merged with develop and back to master? what would be the best solution?

I'm open to suggestions of all kinds.

0 likes
4 replies
ejdelmonico's avatar

Sounds like a good plan if you are working alone or with just a few coders. Personally, when working alone or with another, I use the master for production and a single source of truth. I use a develop branch for dev work. If I want to make large changes to the code base to try something out or make a large feature, I will branch off of develop. When finished with the feature, I merge to develop. Then if the feature is working fine and makes it to production-ready status, I will merge develop to master. Basically, it's whatever works best for you. Everyone has there own way of using git. If you join a project, they will have established a workflow of there own for you to use.

steve_laracasts's avatar

I develop alone (with some help from the lovely folks here of course!) and do this too... well mostly ;) sometimes I am lazy...

It really does come into it's own as soon as you have anyone else involved though and a good skill to have for when this happens! Just do it - there's a little learning curve, but the basics are pretty straightforward - it's very reassuring once you get going.

I follow the same general approach as @ejdelmonico - I think this is really common.

Once you have that going you could try several branches to work on different parts, and merge them back into develop - then you may need to learn about merge conflicts. It looks scary - but it's not really.

Good luck!

Snapey's avatar

I just have master and then create a branch to work on new features so that I can easily get to the current production code to fix an issue. I would like to have tagged releases but cannot seem to get my head around it.

I work alone and for a long time did not see the benefit, but once I started using it, I was all in.

Github's desktop client has given me confidence in that I can review all my commits easily.I tend to get distracted when working on a feature and change something unrelated (eg changing the layout of a page even though I'm not supposed to be working on that. Using the visual client I can deselect the unrelated changes and then make a commit then reselect the remaining changed files and commit again with a new message.

This is not something I could not do from the command line but this is so much easier.

Finally, when it comes to pushing to live, I look back at the history to remind myself what areas I have been working on so that I can give those a quick visual once pushed live.

Please or to participate in this conversation.