Skip to content

Commit 686ffd0

Browse files
authored
Document how to delete remote branches. (python#256)
* Document how to delete remote branches. * Address review comments.
1 parent f39f205 commit 686ffd0

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

gitbootcamp.rst

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,20 @@ on the 2.7 release::
8282
$ git checkout -b 2.7 origin/2.7
8383

8484

85-
Deleting Local Branches
86-
-----------------------
85+
.. _deleting_branches:
86+
87+
Deleting Branches
88+
-----------------
8789

88-
To delete a branch that you no longer need::
90+
To delete a **local** branch that you no longer need::
8991

92+
$ git checkout master
9093
$ git branch -D <branch-name>
9194

95+
To delete a **remote** branch::
96+
97+
$ git push origin -d <branch-name>
98+
9299
You may specify more than one branch for deletion.
93100

94101

@@ -343,7 +350,4 @@ To edit an open pull request that targets ``master``:
343350

344351
$ git push [email protected]:<contributor>/cpython <pr_XXX>:<branch_name>
345352

346-
5. Optionally, delete the local PR branch::
347-
348-
$ git checkout master
349-
$ git branch -D <pr_XXX>
353+
5. Optionally, :ref:`delete the PR branch <deleting_branches>`.

pullrequest.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ Here is a quick overview of how you can contribute to CPython on GitHub:
127127

128128
#. Review and address `comments on your Pull Request`_
129129

130-
#. When your changes are merged, celebrate contributing to CPython! :)
130+
#. When your changes are merged, you can :ref:`delete the PR branch <deleting_branches>`
131+
132+
#. Celebrate contributing to CPython! :)
131133

132134
.. _Clear communication: https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution
133135
.. _Open Source: https://opensource.guide/
@@ -170,6 +172,11 @@ Then push your work to your clone on GitHub::
170172

171173
Make a pull request on GitHub from your changes in ``MY_BRANCH_NAME``.
172174

175+
After your PR has been accepted and merged, you can :ref:`delete the branch <deleting_branches>`::
176+
177+
git branch -D MY_BRANCH_NAME # delete local branch
178+
git push origin -d MY_BRANCH_NAME # delete remote branch
179+
173180
.. note::
174181
You can still upload a patch to bugs.python.org_, but the GitHub pull request
175182
workflow is **strongly** preferred.

0 commit comments

Comments
 (0)