Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to specify branch name on first commit in git?

Tags:

is it possible to perform a first commit on a new repository using a different branch name than "master" ? Thank you

like image 541
itsjavi Avatar asked Jun 27 '12 11:06

itsjavi


People also ask

How do you make a branch from a specific commit?

In order to create a Git branch from a commit, use the “git checkout” command with the “-b” option and specify the branch name as well as the commit to create your branch from. Alternatively, you can use the “git branch” command with the branch name and the commit SHA for the new branch.

How do I name my initial commit?

Usually the first commit is named "Initial commit". As best practice its include a README file describing the project. The README is usually is a md file. You can put any code you wish as well.

Can two branches have the same commit?

Yes, two branches can point to the same commits.


1 Answers

Yes. Before you make any commit you can just do git symbolic-ref HEAD refs/heads/not-master. This changes the name of the branch that you are on (that has no commits).

like image 103
CB Bailey Avatar answered Oct 03 '22 01:10

CB Bailey