when we fire command
git branch -D <branch_name>
git branch -d <branch_name>
what is the difference and how the execution of each of the command occurs?
when we fire command
git branch -D <branch_name>
git branch -d <branch_name>
what is the difference and how the execution of each of the command occurs?
The -d
version first checks if the branch has commits which are unmerged into its upstream counterpart. If there are some, the delete is denied.
The -D
version forces the deletion.
Check the doc if needed.
This is already answered in another thread. Basically this is what's been said
To delete the local branch use one of the following:
$ git branch -d branch_name $ git branch -D branch_name
Note: The
-d
option is an alias for--delete
, which only deletes the branch if it has already been fully merged in its upstream branch. You could also use-D
, which is an alias for--delete --force
, which deletes the branch "irrespective of its merged status." [Source:man git-branch
]