Search code examples
gitgithubgit-branchgit-rm

GitHub branching mess


So, I want to upload a project to GitHub, I have to create a new branch per assignment requests, but when I created it, it cloned what I had in another branch and made it the default branch and for SOME STUPID F. REASON, GitHub doesn't have a simple delete button and everything seems to be complicated, yes, I'm new using GitHub, this is probably a dumb question but I need help.

How do i delete this branch and it's content? (REMOTELY, I DON'T CARE ABOUT LOCAL CHANGES) and how can I create a clean, EMPTY branch where I can simply upload a folder with some code?

I uploaded the first project a while ago, successfully, now I have to create another branch to upload another project, when i created it, IT BECAME THE DEFAULT BRANCH AND FOR SOME REASON IT HAS THE SAME CONTENT AS THE FIRST PROJECT, so now i have three branches with the same things inside, my requests are, HOW CAN I DELETE THE BRANCHES EXCEPT THE ONE WITH THE ORIGINAL PROJECT AND HOW CAN I CREATE A NEW CLEAN AND EMPTY BRANCH, because every time I try to create a branch it clones the first project automatically, it say "make Y branch from X branch"

One last thing, can you be so kind as to make an example with an actual branch name and not the usual placeholder? I'm dumb, the more clear the example the better, Thanks, I appreciate your help


Solution

  • HOW CAN I DELETE THE BRANCHES EXCEPT THE ONE WITH THE ORIGINAL PROJECT

    To delete branches in your GitHub repository, see the documentation that GitHub provides. To delete branches in your local project, use the git branch command. Type git help branch for information on how to use this command.

    HOW CAN I CREATE A NEW CLEAN AND EMPTY BRANCH

    You can't. A branch is used for additional work on top of the existing code in a project. To learn more about branching and what it is used for, see Section 3.2 of Pro Git.

    because every time I try to create a branch it clones the first project automatically, it say "make Y branch from X branch"

    This is how branches work. When you create branch Y from branch X, branch Y contains all of the changes that are in branch X.

    If you want a clean and empty project, you need to create a new repository, rather than a branch. You do this by running git init in a directory that doesn't already contain a Git repository.