Home > Blockchain >  What exactly is the default git branch
What exactly is the default git branch

Time:03-19

Is this a native git concept?

I've been researching this for a while and cannot seem to understand? All I get is Github documentation, and just that master is the initial default branch.

If possible, can someone please explain what this concept means native git-wise.

EDIT: For instance, what setting or idea makes one particular branch the default one ( not necessarily the initial one, but on an ongoing basis ) , and how would one change it outside of something like Github

My intuition is telling me it's where HEAD is pointing to ( in a repository you clone and merge back into, like a bare repository on a server ) in a more general sense, is this close?

Ty!

CodePudding user response:

Is this a native git concept?

No. It's a GitHub (and other host) concept. It goes with pull requests, which are also not a Git concept.

When you make a pull request at GitHub, you push a branch; what branch should GitHub offer, by default, to merge your pull request branch into? That is the default branch.

CodePudding user response:

I know, Github documentation is a bit technical and only related to their features.

Branches are not a GitHub concept but a source code repository concept. The default branch name in Git is master (nowadays main).

From https://www.git-tower.com/learn/git/glossary/master:

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.

This main branch represents the live/production version of your project. Typically, any project changes will go into feature branches first. Feature branches result in pull requests and are merged into master after review.

  •  Tags:  
  • git
  • Related