I just created a new git repository and only did one commit. Now I do not see a master branch. These are roughly the commands I ran.
Now when I do a "git branch -a" I do not see a master and if I do "git checkout -b master" I get an error. After reading "fatal: Not a valid object name: 'master'" I see that this is expected behavior. My understanding is that it is typical (and desirable) for repositories to have a master branch.
So I have 2 questions. What are the steps that I should have followed to keep the master branch? What should I do now to get the master branch back?
Thank you in advance for any help
Joe
The "master" branch has no special status. You can create it or delete it whenever you want just like you would with any other branch.
You'd have gotten a master if you'd committed before creating a branch yourself (so if you'd done your step 2 after the first commit).
Now if you just:
git checkout -b master
You'll have a master branch.
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