VOOZH about

URL: https://github.com/orgs/community/discussions/200357

⇱ removing a branch from a repository Β· community Β· Discussion #200357 Β· GitHub


Skip to content

πŸ‘ @community
GitHub Community

removing a branch from a repository #200357

Answered by farhan2t24
m0cvo asked this question in Repositories
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

Replies: 4 comments

πŸ‘ Image
ZitouniNidhal

0 replies

πŸ‘ Image
farhan2t24

0 replies
Answer selected by m0cvo

πŸ‘ Image
m0cvo
Author

0 replies

πŸ‘ Image
arnobsark

0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.