Home > Enterprise >  Readme file created in GIT remote shows up as a separate branch
Readme file created in GIT remote shows up as a separate branch

Time:05-11

I uploaded my java project and later added a Readme file from the online GIT at the remote. This created a separate branch and the only file I see in the branch is the "readme" file. I later realized that while creating the readme file there was an option at the bottom of the editor which says to directly merge with main or create a separate branch. I think I selected the latter causing a separate branch. Now I went ahead and created the same readme file again and merged directly onto the master. I now need to know how to delete the unnecessary branch called "main" which just has this incorrectly created readme file. Please see the screen shots below. Screen1 - showing separate branch with just the readme file Screen2 - showing the actual master branch were I added readme again

Please let me know how to delete the branch that just has the readme file alone. I tried git pull origin master and it did not work. I got the message something like merging unmatched history etc.

CodePudding user response:

enter image description here

Click on the branches and you will be able to click the delete icon.

enter image description here

I hope this helps you

CodePudding user response:

Only the default branch has the "readme" file that got incorrectly created, and there is no delete option there

Probably because it is the default branch.

You can change the default branch first to the one with your code, and then delete the wrong branch (with the README)

Note that the default GitHub branch is now "main" (since Oct. 2020, as explained in renaming).

A git config --global init.defaultBranch main (as shown here) would ensure your own local repositories are created by default with the same branch name.

  • Related