Git delete branch locally and remotely using cmd

To delete branch from git use the following command 

git push -d <remote name> <branch name>
git branch -d <branch name>

Real example to delete branch from git

git push -d origin branch_name_to_delete

 

Git Delete Branch ( TL and DR Version )

 

If you just want to learn the correct syntax of delete branches in Git you simply need to run following command:

git branch -d <branch-name>

NOTE: if the branch has some unmerge changes then you can not delete branch using the above command to delete a branch with unmerged changes you only need to execute the following command.

git branch -D <branch-name>

Now you need to push deleted branch to remote repository, use the following command

git  push --all


Tags:

git

Share:

Related posts