Skip to content
Discussion options

You must be logged in to vote

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

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by m0cvo
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repositories The core of version-controlled code storage Question Ask and answer questions about GitHub features and usage Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates
4 participants