3 ms·
Is there a reason for -D and not -d? Wouldn't -D also delete the remote branch if you accidentally pushed your changes?
by raducu 7y ago
Is there a reason for -D and not -d? Wouldn't -D also delete the remote branch if you accidentally pushed your changes?
- vvillena 7y ago"git branch -d" doesn't remove a branch if that means losing track of some local commits. "-D" doesn't check that. The "git branch" commands only operate on your local repo, they don't push any changes to remote repos and they don't pull commits from anywhere.
- WorldMaker 7y ago`-D` doesn't involve the remote at all (unless you are using something like the intentional remote:branch syntax which this example isn't). It is a force delete in that if there were commits locally in that branch and only in that branch it should still delete that branch. It should be unlikely you need that force because the first step was to branch everything as is, so it is safer to just use `-d`, but if the intention is to "blat" it from orbit anyway, `-D` is that.