Delete a git branch

This article will demonstrate, how we can delete a git branch from local or remote git repository.

Syntax: git branch -d<branch>
        git branch -d test-branch

If you face any error like “error: The branch ‘test-branch’ is not fully merged” and you are still want to delete this branch then you can forcefully delete. Use ‘git branch -D test-branch’

        git branch -D test-branch

Delete a remote branch:

Syntax: git push origin :<branch>
        git push-origin : test-branch

Delete a local remote-tracking branch:

        git branch -dr <remote>/<branch>

More related Article:

https://techieroop.com/category/scripting/

(Visited 52 times, 2 visits today)