Future-is-bright
Future-is-bright

Reputation: 49

how to use git branch for new feature

I am working on new feature branch feature/b1 and pushed some changes to remote repo. To continue with more changes to the same feature/b1 how to proceed

  1. Create new feature/b2 and push it to remote repo?
  2. Stay in the same feature/b1 and make new changes and push feature/b1 again to the remote repo?
  3. Do we have any merge conflicts if we use the same feature/b1 branch

Upvotes: 0

Views: 196

Answers (1)

Obsidian Age
Obsidian Age

Reputation: 42314

Feature branches should be self-contained. That is to say, a 'feature' (unit of work) should be small enough by design that it does not require any sub-features. As such, you should never need to branch a feature branch from another feature branch.

If there is additional work to be done on the b1 feature, you stay on the b1 branch and make a secondary commit. If there are changes that are not part of the b1 feature, you switch to a different feature branch.

Ideally, you would follow Git Flow, and branch both b1 and b2 off of a dev or develop branch, then create a pull request back to dev / develop when you want to 'combine' the logic. It is at this point that there is the potential for merge conflicts.

Upvotes: 1

Related Questions