Create New Branch

I am in Screen 9 of Git Branches. I am confused that why feature/spam-messages has the same history as feature/random-messages, since feature/spam-messages is newly created branch.

@zhangyongheng78: feature branches will have the same history as the master branch until code modification is made (kinda like a “copy” for you to work on).

1 Like

The purpose of branches is so that you can have multiple independent paths of development. If 1 branch started from 0 from where it appeared, it will not be independent.

Master branch is just named master. There is nothing forcing you to use it as the conceptual master (besides org/team guidelines). Any branch created at any moment in the middle of a project can become a new master, becoming the new central collector of merge requests. Unless in very structured organizations, there is no certainty which branch gets eventually deployed. History must be duplicated so that in case a new branch in future was used and the old one deleted (usually no reason to delete unless all useful code has been merged to another branch and to declutter lists), we can still go back in history to

  1. branch off a commit from the past
  2. make changes/add features
  3. merge to the current