-1

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

  • I understand your frustration. Git can be challenging to understand at first. We can help you better if you provide clear, specific problems that you need help with. Your post here seems to have multiple questions. Take some time to separate out each question individual so we can be clear about exactly what you need help with. – Code-Apprentice Oct 29 '19 at 17:32
  • If I understand correctly, you are creating a GitHub repository for your class assignments and each assignment needs to be on its own branch. Did your instructor provide a repository that you have to clone and start from? Or do you need to start with an empty repository of your own? – Code-Apprentice Oct 29 '19 at 17:33
  • When I google ["github delete a branch"](https://www.google.com/search?client=ubuntu&channel=fs&q=github+delete+a+branch&ie=utf-8&oe=utf-8), the first hit is from [the github documentation](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository). This link explains clearly the steps you need to delete a single branch. – Code-Apprentice Oct 29 '19 at 17:35
  • @Code-Apprentice the repository was already there, I just have to make new branches with each assignment – enriqueMota Oct 29 '19 at 17:47
  • Please edit your question with the details from that comment. – Code-Apprentice Oct 29 '19 at 19:51

1 Answers1

0

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.

Code-Apprentice
  • 81,660
  • 23
  • 145
  • 268