Skip to content

Commit

Permalink
doc: add a nice explainer about how to update PR branches
Browse files Browse the repository at this point in the history
This is good info to have, that I often forget and have to spend time
looking for. It'd be nice to have it documented in the project somewhere
so people new the project (or new to maintaining maybe?) know where to
find it.
  • Loading branch information
niftynei committed Dec 5, 2023
1 parent 5a29baa commit 9c33c5f
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions doc/contribute-to-core-lightning/contributor-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,66 @@ extract-bolt-csv`. By default the bolts will be retrieved from the directory `..

e.g., `make extract-bolt-csv BOLTDIR=../bolts BOLTVERSION=ee76043271f79f45b3392e629fd35e47f1268dc8`


## Pushing Up Changes to PR Branches

If you want to pull down and run changes to a PR branch, you can use the convenient
pr/<pr#> branch tags to do this. First you'll need to make sure you have the following
in your `.github/config`.

[remote "origin"]
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*

Once that's added, run `git fetch` and then you should be able to check out PRs by their number.

git checkout pr/<pr#>


If you make changes, here's how to push them back to the original PR originator's
branch. NOTE: This assumes they have turned on "allow maintainers to push changes".

First you'll want to make sure that their remote is added to your local git. You
can do this with `remote -v` which lists all current remotes.

git remote -v

If it's not there, you can add it with

git remote add <name> <repo_url>

For example, here's how you'd add `niftynei`'s git lightning clone.

git remote add niftynei git@github.com:niftynei/lightning.git


To push changes to the remote, from a `pr/<pr#>` branch, you'll need to
know the name of the branch on their repo that made the PR originally. You
can find this on the PR on github.

You'll also need to make sure you've got a ref to that branch from their repo;
you can do this by fetching the latest branches for them with the following command.

git fetch niftynei

You may need to fetch their latest set of commits before pushing yours, you can do
this with

git pull -r niftynei <pr-branch/name>

Finally, you're good to go in terms of pushing up the latest commits that you've made
(or changed) on their branch.

git push <name> HEAD:<pr-branch/name>

For example, here's how you'd push changes to a branch named "nifty/add-remote-to-readme".

git push niftynei HEAD:nifty/add-remote-to-readme


If that fails, go check with the PR submitter that they have the ability to push changes
to their PR turned on. Also make sure you're on the right branch before you push!


## Release checklist

Here's a checklist for the release process.
Expand Down

0 comments on commit 9c33c5f

Please sign in to comment.