Document how to delete remote branches.#256
Document how to delete remote branches.#256ezio-melotti merged 2 commits intopython:masterfrom ezio-melotti:delete-remote-branches
Conversation
| To delete a branch that you no longer need:: | ||
| To delete a **local** branch that you no longer need:: | ||
|
|
||
| $ git branch -D <branch-name> |
There was a problem hiding this comment.
git branch supports both -D and -d (they are equivalent).
git push only supports -d.
Since it's easier to type and to remember, I switched it to the lowercase form.
There was a problem hiding this comment.
WWWWWHAT. They are not equivalent. git branch -d <branch_name> don't remove the branch and complains if the branch wasn't merged in another branch.
There was a problem hiding this comment.
Hmm they're not quite the same.
-D is the "force" option.
If a PR is not yet merged, -d will not delete the branch I think, you'll get an error.
There was a problem hiding this comment.
You are right, I misread the man page. Apparently -D is equivalent to -d --force which deletes the branch even if it hasn't been merged. Since usually branches get deleted after they have been merged, do you think it's ok to suggest -d anyway? I can also add a note about deleting unmerged branches using -D.
There was a problem hiding this comment.
I've given up understanding when git will accept -d; it usually won't when I think it should. I always use -D.
There was a problem hiding this comment.
Yep. I ended up using the uppercase -D all the time because I don't want to deal with the error message :)
There was a problem hiding this comment.
I guess I'll revert the change to the uppercase -D then.
pullrequest.rst
Outdated
|
|
||
| After your PR has been accepted and merged, you can :ref:`delete the branch <deleting_branches>`:: | ||
|
|
||
| git branch -d MY_BRANCH_NAME # delete local branch |
There was a problem hiding this comment.
The ALL_CAPS_VARIABLE is inconsistent with the <variable> used elsewhere, but it's unrelated to this PR so I didn't change it.
pullrequest.rst
Outdated
| #. Review and address `comments on your Pull Request`_ | ||
|
|
||
| #. When your changes are merged, celebrate contributing to CPython! :) | ||
| #. When your changes are merged, you can delete the branch |
There was a problem hiding this comment.
This should link to the deleting branches section.
Mariatta
left a comment
There was a problem hiding this comment.
Looks good. Thanks @ezio-melotti :)
|
FWIW, it has to be |
|
Thanks everyone for the reviews! |
* Document how to delete remote branches. * Address review comments.
The devguide didn't seem to document how to delete remote branches.
I documented it and added a few links around.