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

conorcan's avatar

GIT messages

I'm wondering what is the best way to make GIT commits with incomplete features. Most of my workflow seems to involve hopping from different parts of the code and working in an almost ad-hoc fashion.

Let me explain my question by illustrating through a concrete example:

  1. I start to write a javascript polling function that calls the server for a JSON response. I notice that the JSON response is malformed..

  2. I work on the PHP server-side code to correct the JSON. I notice that one of the Eloquent queries is sub-obtimal and change that..

  3. I return to the JSON, but notice that the ID in my blade template is wrong, so I turn to that to change it and notice the HTML needs a bit of cleaning up so I start on that ..

I need to go home :) I want to commit my work because:

  • in the morning my boss might ask me to work on a different feature and I'd like to remember what I've done.
  • I should document what I'm doing

but I've started working on 3 different features. What commit message do I leave? Should I commit after each of 1, 2 and 3 even though they are unfinished tasks?

0 likes
5 replies
stanb's avatar

When you work on a front-end feature and you notice something on the back-end is not correct, I think that is part of the feature you work on. Since it was not working properly you can change it in order to get your front-end feature complete.

If the back-end feature is developed in an other branch, stach your front-end changes, switch to the branch where the back-end feature is developed, commit the fix, switch back to front-end and merge the back-end into it. Complete the feature and you are ready to commit.

Sometimes when I have to switch between branches in the middle of something, I describe the feature and say 'working progress' or 'not finished'.

I hope this helps.

conorcan's avatar

@lars Thank you. It seems kind of obvious now that you say it. I've used branches before, but they've had names like 'dev', 'prod', 'forum' (big topics with lots of features), but it never occurred to me to use branches for small aspects within an area that the business/stakeholder would call a feature.

@stanb Thank you. You mention that you leave comments such as 'work in progress' or 'not finished'. To me those are the type of comments I want to leave, but they don't seem like useful comments for the next developer. Imagine the following git log:

commit: 132323242423

Add reply functionality.

commit: 234234

Started email functionality. Work in progress.

commit: 434323

Started email template. Work in progress.

commit: 5345

Continued email functionality. Not finished.

commit: 435345

More progress on email functionality. Work in progress.

To me these descriptions are very generic. Sorry if I'm misrepresenting your advice, but to be honest those are the type of commit messages I leave all the time... 'more development done' .. 'updated code'. Maybe I don't get git messages, but unless they are useful then why use them?

stanb's avatar

I understand and I was assuming that you was using branches for different features.

So probably the best for you is as @Lars mentioned to use branches for smaller features.

You can even make sub-branches like features/email-functonality Currently I use Jira for tickets and backlog so a branch of my looks like features/ticket234-email-functionality. You can do the same for bugs like bugs/bug12-mail-not-working

For big features you can take it even a step further to make a sub development like Features/email-fuctionality/development Features/email-fuctionality/templating Features/email-fuctionality/sending Features/email-fuctionality/....

Than when a sub branch is ready for testing merge it into Features/email-fuctionality/development and merge your main development in it as wel, so you can test the latest working branch with the new feature before merging it into the main development and from there merge it in to master.

If you use a GUI for git like sourcetree or something it will create a kind of folder structure. It can be very usefull for larger projects.

I hope it makes sence :)

1 like
conorcan's avatar

Thank you for giving me an outline of what you do :) Looking forward to trying it out, seems wise.

Please or to participate in this conversation.