GitHub pull request reviews line comments behaviour - github

Recently GitHub introduced some new features including Pull Request Reviews.
In the past, line comments in Pull Requests would collapse like this after the line was changed in further commits:
Since the launch of the new feature, line comments no longer collapse even after further commits that address the issues. So far I've only had one PR and I'm not sure if the reviewer added single comments or used the new "Start a review" feature.
How can I get the old behaviour back or does it improve in the new "Start a review" feature?
I've watched their video tutorial on this feature and I can't determine whether the behaviour right now is what I'm supposed to be experiencing.

I sent a message to GitHub support and received the following response:
Sorry for the trouble! We are aware that with reviews comments no longer become "outdated" after new code is pushed.
This is definitely on our radar as something we need to address. I can't give a timeline for it, but we will be looking into it soon.

Since two years ago, GitHub now (august 2018) proposes "Collapse all diffs in a pull request at once":
When a pull request contains a lot of changed files, code reviewers can find it hard to isolate the changes that are relevant to them.
Now you can collapse (or expand) the contents of all diffs in a pull request by holding down the alt key and clicking on the inverted caret icon in any file header.
You can then go one step further by using the “Jump to file or symbol” dropdown to jump to the file that you’re interested in and automatically expand it.
That is not exactly the old behavior, but that does still improve the code review process.

Related

Pull Request outdated label

I have a PR where I left several comments in my review on GitHub
A colleague has updated the code to apply my suggested changes, and now all my review comments appear with the outdated label.
However I still see the code in the state it was when I commented it.
What I want is an easy way to see the new code he has written, not the old. Is it possible at all?
Open the PR and Click on the files changed tab. All the latest changes that have been pushed to the branch requesting the PR will be available.

Change author of Pull Request in GitHub / Create PR in someone's stead

tl;dr I created a PR in someone's stead. Now I can't submit a review. Is there a way around?
The other developer messed up and merged a feature to the target branch, so I reverted their changes, fixed the issues, squashed and rebased their work while still keeping their authorship on the commit and I created a new pull request. Now, when I want to submit a review, it prevents me to Request changes, because now I am the author of the PR. How can I change it so that the other developer is responsible and receives the review?
You cannot change the author of a pull request or create one in somebody else's name. GitHub doesn't allow this because it would permit people to forge pull requests and let another person receive negative feedback. For example, if I opened a PR in your name containing something wildly inappropriate (say, a racist slur), you'd be blamed for it unfairly. Moreover, in some regulated environments, keeping an accurate record of who contributed code is very important for legal reasons, which is another reason why this isn't permitted.
In most cases, if a commit gets reverted, then just have the original author open a new PR. Clearly they'd wanted to submit the code in the first place. You can even create the branch for them with their commit squashed and prepared, as long as they open the PR. This is a case where a helpful conversation with another contributor goes a long way, and presumably you'd want to let them know in a kind way that they made a mistake and that you reverted it anyway. Since there's no way to create a repository on behalf of another user, you should close your PR and ask them original submitter to open it instead.
I think it's obvious why you can't approve your own PRs. I can see that this is a situation where requesting changes might be useful, but I suppose the rationale is that you wouldn't have opened the PR if you thought it needed improvements, and if you later learned that, you certainly would revise it instead of merging it.
Although bk2204's answer is correct and explains why there isn't a one-button solution, it doesn't address the actual question of:
How can I change it so that the other developer is responsible and receives the review?
The only way to that is to close out the PR you opened and have them open it instead.

Disable "hidden conversations" in GitHub pull requests?

When I go to a page of an open PR in GitHub, e.g. https://github.com/xyz/abc/pull/123, when the number of conversations exceeds some limit, GitHub automatically collapses some of them in the middle under a box that says "[n] hidden conversations"; you have to click "Load more" in order to see them.
Since the open conversations are the most important thing on a PR and the reason I open or refresh the page in the first place, is there a way to undo this and always show all the conversations? I haven't seen anything relevant in settings; does a browser extension exist to do this?
I've had the same issues. This isn't a solution, but it might be a workaround. I only just discovered it, so I'll have to see how it feels going forward.
In a GitHub PR, change the tab from "Conversation" to "Files changes"
There's a new dropdown called "Conversations", which seems to list all of them.
User ldog explains some limitations with this in the comments below:
Unfortunately this only works if the comments are in sync with the latest commit or the commits that you are currently looking at, if you wanted to see all comments across all commits, this doesn't work. For example, when clicking on a comment that no longer exists due to code changes in a commit this does nothing.
I would prefer to find the same solution the OP is seeking, but I wanted to share this for anyone else landing here with the same issue in case someone finds it helpful.
Also, I'm cross-posting this information in a related webapps.stackexchange question: https://webapps.stackexchange.com/questions/148308/how-to-always-show-all-pr-conversations-in-github

How to comment on long github diff

One of the files in a pull request that I'm currently reviewing has too many changes and github only shows the summary about deletions and additions.
This is rather unfortunate, since I can't comment on the changes that happened in this file. Is there any way to force github to show the diff for this one file in the PR and enable the comment functionality?
Thanks!
You can't force it to comment from the browser, but you can workaround it to create the comment and have someone see it.
In Large github commit diff not shown, they say a Hubber said:
We have some limits on diffs that we show in the browser in order to keep the pull request and compare pages working.
As of today, GitHub's help still states there are (bigger) limits.
If you know the lines you want to comment you could use GitHub's API to create the comment. I don't know if that comment will show on the diff page (I don't think so, as there won't be a diff at all), but you will certainly see it on the comments tab, as usual.

How to view line comments in GitHub?

I spent all morning in GitHub reviewing a pull request, writing detailed comments on many lines in the Diff view on the pull-request page.
I individually saved every line-by-line comment, and they all appeared in their correct places. I left the pull-request page, and when I returned to it, all my line-by-line comments were gone!
I have no idea why they disappeared, where they went, whether other users can see them and I can't, what any of this means, and whether I can trust myself going forward using GitHub, or whether I just have to go back to the telephone and fax for remote collaboration!
I did some web searches such as "how to view line comments in GitHub" for info about this, but could not find anything to relieve my panic. I will be grateful for advice and clues.
This is top result for "Can't view github comments" in google.
If you're here because you've left comments, and can see your own comments, but others cannnot, then check for a yellow pending label on your comments. Others cannot see your comment until you've completed the review process and selected whether you want to request changes. Once you click through a full review, then others will see your comments.
Note: I'm answering a slightly different question than the O.P., but I have a feeling that lots of other devs with this issue are hitting this stackoverflow question. I'm just hoping to help them. I myself had this issue and couldn't find a more relevant answer than this thread. :)
The line-comments depend on the commit that were made on.
If the person that made the pull request rebased that commit then you're not looking at what you were previously looking. It's a different commit, thus there are no comments.
Look on the 'Your Actions' tab and find a line in the actions' history were you commented on that commit, click that commit and you'll see the comments are still there.
If the commit was rebased, you wont find that commit were it used to be (some branch) and not on any repo probably (if it's not on another branch). It is just cached by git and github, until the garbage collector kicks in.
The old answer doesn't work for me because I don't see Your Actions or Public Actions now.
My pending comments disappeared after I started typing into what I thought was a comment I'd opened for editing. It wasn't open, and one of my keys may have been a shortcut. I could still see the button to finish my review (including the count of my pending comments) but the comments had disappeared.
I eventually got them back by navigating to the pull request, then to the commit I was reviewing.