Comment on a line in Github without a commit?

GithubComments

Github Problem Overview


In github, you can comment on lines in a commit. Is there a way to comment on a line, while viewing a file in a branch, without having a particular commit?

Github Solutions


Solution 1 - Github

Unfortunately it is not possible to comment on a line in Github without a commit.

But you can create links to lines in your file (click on line and copy link on browser bar). For example you can use this links in your issues to discuss about code line:

https://github.com/sebastianbergmann/phpunit/blob/master/src/Runner/StandardTestSuiteLoader.php#L72

Update

You can also hold shift to obtain a link to a block of lines

Solution 2 - Github

This blog post provides a simple way to use github's built-in commenting features for this: http://astrofrog.github.io/blog/2013/04/10/how-to-conduct-a-full-code-review-on-github/

Solution 3 - Github

You should have at least one commit: your initial import ;-) So if you never touched the file afterwards, you can still browse your master branch (or wherever you did the initial import to).

To get to a commit of file, do as follows:

You should now be able to comment the file.

Solution 4 - Github

I wanted to do the same thing, for a code review.

I ended up:

  1. forking the repo
  2. adding my comments in the source code (e.g. // TODO: ...)
  3. making a pull request

Solution 5 - Github

The only way if you use a different tool for this job. I use Fisheye, or Review-Board for do pre-commit revision code.

Review Board is free, and handle better than Fisheye the pre-commit code.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionmlepageView Question on Stackoverflow
Solution 1 - GithubFarid MovsumovView Answer on Stackoverflow
Solution 2 - Githubuser553965View Answer on Stackoverflow
Solution 3 - GithubSebiView Answer on Stackoverflow
Solution 4 - GithubAdrien JolyView Answer on Stackoverflow
Solution 5 - GithubPablo MoralesView Answer on Stackoverflow