Im have strange problem:
$ cd ~/htdocs $ mkdir test $ cd test $ git init Initialized empty Git repository in /home/deep/htdocs/test/.git/ $ git checkout master error: pathspec 'master' did not match any file(s) known to git. $ git checkout -b master fatal: You are on a branch yet to be born $ git checkout origin/master error: pathspec 'origin/master' did not match any file(s) known to git. $ git branch -a (empty this)
But this is new local empty repo. Where is master branch?
Branching means you diverge from the main line of development and continue to do work without messing with that main line. In many VCS tools, this is a somewhat expensive process, often requiring you to create a new copy of your source code directory, which can take a long time for large projects.
The git branch command is actually something of a branch management tool. It can list the branches you have, create a new branch, delete branches and rename branches. Most of Git Branching is dedicated to the branch command and it's used throughout the entire chapter.
As ever, Git is right, it just has a quirky way of saying it: when you create a repository, the master branch actually doesn't exist yet because there's nothing for it to point to.
Have you tried committing something after your git init
? Adding a remote and pulling from it will also work, of course.
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