Reputation: 41749
Let's say I have 10 tasks and want to create a new Git branch for each task. Each task uses it's own class so there will not be situation that task10
needs a code from task8
.
Should I do like this:
Or the proper way is:
Which one is proper approach?
If the FIRST approach is the corrent one, should new branch be a branch of master or a new branch should be a branch of the previous task?
Upvotes: 0
Views: 32
Reputation: 76837
If all your tasks are independent, then they should each branch off from master
, so the second approach will be suitable. If two tasks are mutually related, they can usually be combined into a single task, independent of all others.
The flow is similar to your second approach, with some variation:
While it is true that uncommitted changes can be committed later to a new branch in git, I prefer creating a new task branch before starting the code, so that any changes etc I might need to make to the branch stay on that branch, and other branches (including master
) remain unaffected. Preventing any accidental rewrite of master branch's history becomes all the more critical since it is the reference branch for all other branches. The other important advantage is you can work on multiple tasks simultaneously.
Upvotes: 1