I was discussing git-flow with my coworkers and they brought up an interesting point. Why not tag releases off of develop instead of master? Master seems to exist for the sole purpose of tags. Maybe I missed something obvious when I read the entire article for git-flow.
In Git, "master" is a naming convention for a branch. After cloning (downloading) a project from a remote server, the resulting local repository has a single local branch: the so-called "master" branch. This means that "master" can be seen as a repository's "default" branch.
If the current branch is not outdated compared to the one you pull from, pull will say Already up-to-date. even if you have local changes in your working directory. git pull is concerned with branches, not the working tree — it will comment on the working tree only if there are changes which interfere with the merge.
No, the main branch can be any branch you want. By default, when you create a repository, the main branch is named the master branch. It is the base branch or the default branch. You can go through How to set up default branches in Git to know more.
Instead of a single main branch, this workflow uses two branches to record the history of the project. The main branch stores the official release history, and the develop branch serves as an integration branch for features.
You cannot simply tag develop
for 2 reasons: release
branches and hotfixes
branches.
release
branches - once you create your release branch from develop
to prepare for a release, then you have your "release candidate" that will only get limited changes while the main development branch develop
may continue to get additional commits not intended for this release, e.g. changes intended for a future release. Even if you merge the changes from the release
branch into develop
, you will still have additional commits on develop
that aren't intended for release, i.e. you can't tag develop
. Also note that release
branches are temporary branches that go away after release while master
(and develop
) are long-lived "permanent" branches.
hotfix
branches - A similar situation exists for a hotfix - you create a hotfix temporary branch (from your last release) to allow you to isolate which commits go into your hotfix release (just specific bugfixes).
You could tag the final commits of the release
branches and hotfix
branches and/or make those branches long-lived branches, but git-flow model uses master
to track and connect the releases.
master exists by convention. If you want to establish a different convention you can. the idea of a master branch may or may not suite your purposes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With