How to delete branch in github

--

Deleting a branch LOCALLY

git checkout main

Delete a branch with git branch -d <branch>.

For example: git branch -d fix/authentication

The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.

The branch is now deleted locally.

Deleting a branch REMOTELY

Here’s the command to delete a branch remotely: git push <remote> --delete <branch>.

For example: git push origin --delete fix/authentication

The branch is now deleted remotely.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Mohammad Farman Abbasi
Mohammad Farman Abbasi

Written by Mohammad Farman Abbasi

Learning each day without giving up.

No responses yet

Write a response