Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docs:guide-developer:working-with-github-pr [2019/04/06 02:48] – LEDE > OpenWrt vgaeteradocs:guide-developer:working-with-github-pr [2023/03/18 23:29] (current) – [Reopen closed PR] he/she -> they ryanc
Line 1: Line 1:
-===== Working with GitHub =====+====== Working with GitHub ======
 There are GitHub mirrors of the source repository [[https://github.com/openwrt/openwrt|here]]. There are GitHub mirrors of the source repository [[https://github.com/openwrt/openwrt|here]].
  
Line 75: Line 75:
 You will be asked your GitHub user and password in the process. You will be asked your GitHub user and password in the process.
  
-After the code has been uploaded to your GitHub repo, you can submit PR using GitHub web interface, see again GitHub's documentation about [[https://help.github.com/articles/creating-a-pull-request/|Creating a pull request]].+After the code has been uploaded to your GitHub repo, you can submit pull request using GitHub web interface, see again GitHub's documentation about [[https://help.github.com/articles/creating-a-pull-request/|Creating a pull request]].
  
 ===== Squashing commits ===== ===== Squashing commits =====
Line 145: Line 145:
  
 Where X is a number of commits to edit. Where X is a number of commits to edit.
 +
 +
 +===== Reopen closed PR =====
 +
 +GitHub will grey out "Reopen" and will not let you reopen a PR if you force-pushed anything to the relevant branch after the PR has been closed, or deleted the branch.
 +
 +However, reopening is still possible if you just set back the GitHub branch to the exact commit ID/hash it was at when you closed it. This even works when the branch or even the whole repository was deleted on GitHub. It just has to be recreated with the same name (for repo and branch) and the same commit hash at the branches HEAD.
 +
 +A possible way to do that would be (there might be others, even shorter ones):
 +
 +//We assume that the git remote referring to GitHub is called "origin", the branch of interest is called "testbranch", and the local and remote branch names are the same.//
 +
 +<code bash>
 +# Get the hash yyyyyyyyyyyyyyy of the current state of "testbranch" (we will move the branch head later)
 +git log -1 testbranch
 +# Checkout the latest state of the PR (commit hash xxxxxxxxxxx)
 +git checkout xxxxxxxxxx
 +# Delete old testbranch
 +git branch -D testbranch
 +# Label current state as testbranch
 +git checkout -b testbranch
 +# Push old state to GitHub
 +git push -f origin testbranch
 +</code>
 +
 +
 +Now you got GitHub at the state it was at when closing the PR. It should now be possible to "reopen" the PR.
 +Note that this will only be possible if //you// closed it. If it was closed by an admin, you will have to ask an admin to reopen it (though they will also only be able to do that when the branch is at the proper hash).
 +If the PR is reopened, you can update as usual, e.g.
 +
 +<code bash>
 +# Checkout the desired hash yyyyyyyyy (or branch)
 +git checkout yyyyyyyyy
 +# Delete intermediate testbranch
 +git branch -D testbranch
 +# Label current state as testbranch
 +git checkout -b testbranch
 +# Push new state to GitHub
 +git push -f origin testbranch
 +</code>
 +
  
  • Last modified: 2019/04/06 02:48
  • by vgaetera