19
I’m studying Git and from what I’ve seen about branches I’ve basically identified two major situations where branches are useful:
When we have a stable version of the code in the master branch and want to add a new functionality, we then create a branch to develop the functionality without having the danger of breaking what we already have in the master branch.
When we have a stable version of the code in the master branch and need to fix any bugs found, we create a branch to work on this bug and do not run the risk of damaging the stable code
These two uses seem to be quite common, because I have also seen in many articles and videos they are cited. The point is, I’ve also heard that more experienced Git users recommend doing a lot of branch work. Once I saw even an answer in Stack Overflow in English that said the ideal is to start branches earlier and always use branches.
It turns out that in these two cases that I identified which branches would be useful, the utility comes from the fact that there is a stable code that is not interesting to move around and we want to have the freedom to work on something without screwing up that code. I can’t see how before we have a stable branching code it might be useful.
That way, when branches are really useful in Git and why this recommendation to start using branches from scratch and always use?
Or more than one stable code version, for example a new version with root changes in the code structure. I read for some time about gitflow, I think it’s good to give a read.
– gmsantos