No master branch in git / BitBucket

17.2k views Asked by At

I'm new to git. I'm using bitbucket with sourcetree client. I've cloned the repository from bitbucket in the sourcetree ,and then I wanted to create a Develop branch from Master. The thing is : there isn't any master branch. I've tried committing some text file , and then I was able to create that Develop branch , but I still don't see master branch in BitBucket ,so I can't create pull requests from the Develop branch to master...

What have I done wrong? Thanks

5

There are 5 answers

5
poke On

master is just a name for the usual default branch. But it doesn’t need to be called that way. If you do git branch -r you can see what branches exist on your remote, so you know which branch you could create a pull request for.

If you really want a master branch, you could just create a new branch.

1
paulyb On

In Bitbucket, commit the default README.md file that Bitbucket offers to generate. The master branch will be created upon committing the README.md file.

0
Mohit Khandelwal On

You have to initialize your repository with your username and name, after that your master branch will be created and you will be able to commit your code.

git config --global user.email "[email protected]"
git config --global user.name "Your Name"
0
Abhishek On

If you will try to clone the empty repository, while cloning you should be getting the following message in command line prompt.

Cloning into 'test'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

So, it means you are starting a project from scratch. In this case you have to follow the following steps -

mkdir /path/to/your/project
cd /path/to/your/project
git init
git remote add origin "Your Repo Url"
git add -A
git commit -m 'Your Commit Message'
git push -u origin master

Same streps are also mentioned in bitbucket home page of your repository. It will create your master branch.

1
Prakhar Bhatt On

In BitBucket,

Click on Commits, and commit any file (A sample readme and .gitignore file). It will be automatically commited to the master branch.

And then you will be able to see the master branch and can create new branches also.