DEV Community

Discussion on: Delete a Git branch both locally and remotely [Shell aliases + functions] #OneDevMinute

Collapse
 
math2001 profile image
Mathieu PATUREL

Nice tip!

Any reason for using force to delete local branch though (git branch -D "$1", the d is majuscule)?

I think it'd be safer to use git branch -d "$1"

Collapse
 
ahmadawais profile image
Ahmad Awais ⚡️ • Edited

Thanks.

I think that's because it avoids the message of the branch not being merged?

Collapse
 
math2001 profile image
Mathieu PATUREL

Yes, so that means you lose your code (hence the force).