Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git strategy for when you need to work on several features at a time

Let's say I am working on a few front-end features concurrently that all are in different branches (e.g. login branch, reset password branch, update settings branch, etc.). In our current workflow, it's up to me in which order or manner I finish all these features as long as I do them within the set deadline (e.g. 2 weeks time).

To pace myself better, I'd create a branch for each of these features and work on them concurrently, integrating the functionalities first (the hard parts so to speak) and work on the styles and nitty-gritty details towards the end. (Analogy would be like building a house; you don't really complete each part of the house one by one. You build all the foundation first, scaffolding and all, before you do all the decorative stuff towards the end.)

Now this is fine if all of these features are totally isolated from one another. However, there are functionalities or even general styles that I've done on e.g. login branch that I can actually use in reset password branch. (Example, both are forms hence should have the same general form styling and will make use of the same validation functions).

However, since all of them are WIP all at once, I cannot do a PR for login before I continue working on reset pw (e.g. login is at 90% and reset pw at 80% but I need something from login to get reset pw to 90% completion also). Even if I complete login, PR reviews may take time.

I also cannot also e.g. merge/rebase to login from reset pw because 1. that would mix the 2 different features and 2. login feature is not even approved yet.

What is the best strategy for this kind of scenario? I am in a dilemma because the best way to actually avoid this is to finish one feature after another. But at the same time, I work better if I do it in the manner I just mentioned (in parallel).

like image 992
catandmouse Avatar asked May 30 '19 15:05

catandmouse


1 Answers

This is opinion based but I would work on all these three features on a single branch. e.g. I should be able to login. That doesn't require reset pw. Once the login feature is done, I push that for code review or whatever. After that, I add the password reset functionality as a different set of commits and send that for review.

The general point is that if the features are coupled, the split is artificial and it's better to treat them as a single branch. If the features are coupled, it's usually still possible to sort them in order of dependency and implement them in order.

like image 126
Noufal Ibrahim Avatar answered Oct 14 '22 02:10

Noufal Ibrahim