π @community
GitHub Community
removing a branch from a repository #200357
Answered
by
farhan2t24
m0cvo
asked this question in
Repositories
Β·
4 comments
Answered by
farhan2t24
If the broken code is only on the second branch, you can safely delete that branch without affecting your main (or master) branch.
Using the GitHub website:
Open your repository.
Go to Branches.
Find the branch you want to remove.
Click the Delete (trash can) icon next to that branch.
Using Git:
git checkout main
git branch -d branch-name
If Git refuses because the branch isn't merged and you're sure you want to remove it:
git branch -D branch-name
To delete the remote branch as well:
git push origin --delete branch-name
Deleting a branch does not delete or modify your main/master branch. Just make sure you don't need any commits that exist only on the branch you're deleting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Category
Repositories
