other

Delete a git branch from local and remote machines - commands

You can execute the below commands to delete a branch from the remote origin and locally.

/* TO DELETE FROM REMOTE */
git push -d origin {branch_name}

/* TO DELETE FROM LOCAL */
git branch -d {branch_name}

For example, if you have created a branch named 'component' on local and remote also. If you want to delete this branch from the local git system execute below command from cmd on windows and terminal on MAC

git branch -d component

This will remove the branch from the local system and to remove this branch from remote execute below command

git push -d origin component
Was this helpful?