github拉代码提交_如何使用GitHub进行代码审查?

GitHub has a great mechanism for discussion around commits and pull requests. However, if I have created a repo, and I'd like someone to comment on all of the code in my repo, what's a good way to allow them to do so?

Commits exist, but only show windows of code at a time, so do I have to create commits which cover every line of all files of interest?

If so, is my best option to touch every file by adding a space at the end of each line? (yuck). I can create this commit in a branch and then issue a pull request to my own repo from that branch, to not pollute master.

for x in ; do sed "s/\$/ /g" $x > $x.new; mv $x.new $x; done

Update:

With inspiration from @VonC, I used the following process which I believe is the simplest and best, since it doesn't disturb the master branch or require my reviewers to expend any additional effort.

1. In my local clone of my repo, I created a branch called code_review.

git checkout -b code_review

2. In that branch, I removed any files I wanted reviewed, committed that change, and pushed.

git rm -rf *

git commit -am "files to be code reviewed"

git push origin code_review -u

3. At Github, from the master branch, I issued a pull request for the code_review branch. This was an option from the main screen for this project.

4. Finally, I sent my reviewers a link to this pull request so they could comment on my code line by line. Make sure to tell them to click on the "files changed" tab for inline commenting.

解决方案

Update 2016: At GitHub Universe 2016, GitHub introduced enhanced reviews

our first step is now available on all pull requests—Reviews. In addition to commenting on specific lines of code, Reviews let you formally “approve” or “request changes” to pull requests. You can also leave a review summary and delete, edit, or bundle comments before you submit them.

If you change the default branch of your Github repo by an empty branch, a colleague managing a fork should be able to do a pull request to your Github repo, which would show the full code.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值