From e34d61463dc06962bd1af2ae978f5cc6c030daec Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Tue, 5 Sep 2017 00:26:06 +0300 Subject: [PATCH 1/2] Document how to delete remote branches. --- gitbootcamp.rst | 20 ++++++++++++-------- pullrequest.rst | 9 ++++++++- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gitbootcamp.rst b/gitbootcamp.rst index 693ebade22..99d7478e13 100644 --- a/gitbootcamp.rst +++ b/gitbootcamp.rst @@ -82,12 +82,19 @@ on the 2.7 release:: $ git checkout -b 2.7 origin/2.7 -Deleting Local Branches ------------------------ +.. _deleting_branches: + +Deleting Branches +----------------- -To delete a branch that you no longer need:: +To delete a **local** branch that you no longer need:: - $ git branch -D + $ git checkout master + $ git branch -d + +To delete a **remote** branch:: + + $ git push origin -d You may specify more than one branch for deletion. @@ -343,7 +350,4 @@ To edit an open pull request that targets ``master``: $ git push git@github.com:/cpython : -5. Optionally, delete the local PR branch:: - - $ git checkout master - $ git branch -D +5. Optionally, :ref:`delete the PR branch `. diff --git a/pullrequest.rst b/pullrequest.rst index 14cca68982..58d447e939 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -127,7 +127,9 @@ Here is a quick overview of how you can contribute to CPython on GitHub: #. 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 + +#. Celebrate contributing to CPython! :) .. _Clear communication: https://opensource.guide/how-to-contribute/#how-to-submit-a-contribution .. _Open Source: https://opensource.guide/ @@ -170,6 +172,11 @@ Then push your work to your clone on GitHub:: Make a pull request on GitHub from your changes in ``MY_BRANCH_NAME``. +After your PR has been accepted and merged, you can :ref:`delete the branch `:: + + git branch -d MY_BRANCH_NAME # delete local branch + git push origin -d MY_BRANCH_NAME # delete remote branch + .. note:: You can still upload a patch to bugs.python.org_, but the GitHub pull request workflow is **strongly** preferred. From 78797172ba47e024620829cd0015426540289b0f Mon Sep 17 00:00:00 2001 From: Ezio Melotti Date: Tue, 5 Sep 2017 00:52:11 +0300 Subject: [PATCH 2/2] Address review comments. --- gitbootcamp.rst | 2 +- pullrequest.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gitbootcamp.rst b/gitbootcamp.rst index 99d7478e13..25d0b4f821 100644 --- a/gitbootcamp.rst +++ b/gitbootcamp.rst @@ -90,7 +90,7 @@ Deleting Branches To delete a **local** branch that you no longer need:: $ git checkout master - $ git branch -d + $ git branch -D To delete a **remote** branch:: diff --git a/pullrequest.rst b/pullrequest.rst index 58d447e939..4a110d728c 100644 --- a/pullrequest.rst +++ b/pullrequest.rst @@ -127,7 +127,7 @@ Here is a quick overview of how you can contribute to CPython on GitHub: #. Review and address `comments on your Pull Request`_ -#. When your changes are merged, you can delete the branch +#. When your changes are merged, you can :ref:`delete the PR branch ` #. Celebrate contributing to CPython! :) @@ -174,7 +174,7 @@ Make a pull request on GitHub from your changes in ``MY_BRANCH_NAME``. After your PR has been accepted and merged, you can :ref:`delete the branch `:: - git branch -d MY_BRANCH_NAME # delete local branch + git branch -D MY_BRANCH_NAME # delete local branch git push origin -d MY_BRANCH_NAME # delete remote branch .. note::