Digital Marketing

Delete a Git branch

$ git push -d <remote_name> <branch_name>
$ git branch -d <branch_name>

Normally the remote name is origin. In most case you'll have to use the command like:

$ git push -d origin <branch_name>

To delete Local Branch

To delete the local branch use one of the following:

$ git branch -d branch_name
$ git branch -D branch_name

The -d option is an alias for --delete, which only deletes the branch if it has already been fully merged in its upstream branch. 
By contrast -D, which is an alias for --delete --force, which deletes the branch "irrespective of its merged status."

If other machines have the branch, you can run git branch -a to verify.
To get rid of the branch on other machines run git fetch --all --prune


Popular posts from this blog