1

I made and merged a PR and want to rename the branch I made the PR off of. How can I do this? Let me know if you have questions.

NGI
  • 192
  • 9
  • Does this answer your question? [Renaming a branch while on pull request](https://stackoverflow.com/questions/20007578/renaming-a-branch-while-on-pull-request) – Sharad May 19 '21 at 05:20
  • @Sharad I think this is only for open PRs. – NGI May 19 '21 at 05:46
  • You can rename the branch wherever you like, but if the merge is already done, this has no effect on the merge. The merge is done. – torek May 19 '21 at 06:06

1 Answers1

-1

Editing post to give a reference on how to change the branch name inside an already merged PR. I practically tried this on my side, pushed to GitHub, changed the branch name in the PR that is merged, I can clearly see the change reflecting.

Please follow the below steps:

(base) Apples-MacBook-Pro:CrashCall pratapalokraj$ git branch
* Test
  main
(base) Apples-MacBook-Pro:CrashCall pratapalokraj$ git push origin Test
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'Test' on GitHub by visiting:
remote:      https://github.com/Blank000/CrashCall/pull/new/Test
remote:
To github.com:Blank000/CrashCall.git
 * [new branch]      Test -> Test 

After pushing changes in a new branch ( Test ), now I raised a PR with Test branch and merged into main as below and then changed the branch name from Test to Renamed_Test:

Raised a PR

Merged the PR

Can see PR being merged

Click on view all branches from the below screenshot

Go to All branches

Click on the right most edit button you see down below:

Edit Branch name

Renaming branch

Rename window

Trying to rename

Renamed completely

For reference you can also visit this page:

Rename Branch

halfer
  • 19,824
  • 17
  • 99
  • 186
Pratap Alok Raj
  • 1,098
  • 10
  • 19