Struggling to understand how to work with remote branches and how many types of git branches there are I somehow got lost in differing namings and git versions. Here's a few things that happened to me, while believing there are only TWO types of git branches:
So, after having spent some time mainly at http://git-scm.com/book and on stackoverflow, I got to the conclusion that I can actually describe FOUR instead of the commonly described two types (local vs remote) of git branches. I decided I would try to draw my understanding of how to work with remote branches, I know it is extremely reduced, but the idea would be to point in the right direction and get an idea of the different branch levels:
Edit: New picture, incorporating dunni's comment.
What do you think, how much did I get wrong? What should be added/noted?
The two primary branches in Git flow are main and develop. There are three types of supporting branches with different intended purposes: feature, release, and hotfix.
The master branch is a default branch in Git. It is instantiated when first commit made on the project. When you make the first commit, you're given a master branch to the starting commit point. When you start making a commit, then master branch pointer automatically moves forward.
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.
You have one error in your picture: The branch origin/master doesn't exist on the server, it's called master. The branches on the server are just local branches from the servers POV.
I also wouldn't distinct between tracking branches and purely local branches, because the branches itself have no differences, other than the little configuration, which would simplify/enable pulling and pushing. But you can also pull to a local branch, which has no tracking configuration, you just need some additional arguments for the pull command.
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