Learning center

How to preserve a GitHub review comment when its line moves

Keep the comment’s stable ID, its review and thread relationship, the original commit and the original diff coordinates available from the API. A current line number can be missing or refer to a different version of the file after a push.

Restore an old inline warning#

Suppose a reviewer comments on a fallback branch in src/retry.ts. The author then moves the fallback to a helper and replies that the old branch is gone. In an export, showing only the current file and line can make the warning look like it refers to the new helper.

Keep the path, original commit, original line or position fields and the diff hunk GitHub returned. For replies, keep the parent comment ID. The exported record can show the old hunk beside the author’s response without projecting it onto the new code. Preserve a link to the original thread for readers who still have access. GitHub review comment response fields

Try the export before and after the move. A reader should be able to answer what the warning referred to from the earlier data, even if the record retained only an approved excerpt. If the whole original file is needed, preserve its Git objects.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading