Comment on a line in Github without a commit?
GithubCommentsGithub 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:
- open homepage of your repo, e.g. here Ruby on Rails
- browse to the file you like to comment, e.g. Rails' .gitignore file
- there's a button called history, click it to see latest commits of this file
- look for a commit and click the link with the revision ID
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:
- forking the repo
- adding my comments in the source code (e.g.
// TODO: ...
) - 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.