选中多行代码添加 Comment

一些朋友可能或多或少都会在 GitHub 参与一些项目的 Code Review(以下都简称 CR) 工作。以前的 GitHub,CR 体验并不好,你无法同时选中多行代码进行 comment。

然而很多时候,我们是需要针对一个代码块进行 comment 的,只能选中一行代码进行 comment 并不满足我们的需求。

太棒了,GitHub Review 代码能力小升级
wechat-talk

可能会有一些第三方工具提供相关的功能,但是仅仅一个 CR 的小需求,还要借助其他工具完成,确实是有点麻烦。

好消息就是,现在,没错,就是现在,GitHub 终于为我们已经提供了多行代码 comment 的相关功能。

太棒了,GitHub Review 代码能力小升级
multiline-drag-explainer-final

举个栗子。

比如说,如果你想在第 3-8 行的代码块添加 comment,那么你只需要按住行号 3 后面的蓝色+按钮,往下拖拽到第 8 行,就能选中这个代码块了,之后进行 comment 就可以了,简直完美。

太棒了,GitHub Review 代码能力小升级
GitHub-CR-Demo

不止于 CR

其实,GitHub 近一年已经推出了不少强大的功能或服务,包括:

GitHub Actions[1]

太棒了,GitHub Review 代码能力小升级
GitHub-Actions

GitHub Actions 可以为项目自动构建工作流,比如代码检查、自动化打包、自动化测试、发布版本等等,目前该功能处于 beta 测试阶段。

GitHub Package Registry[2]

太棒了,GitHub Review 代码能力小升级
GitHub-Package

GitHub Package Registry,也即是包管理服务,可以方便地伴随源代码发布公共或私有包。

官方是这样描述的:

With GitHub Package Registry you can safely publish and consume packages within your organization or with the entire world.

目前 GitHub 包管理功能仍处于 beta 测试阶段,想优先体验的朋友,可以进行申请。

GitHub Repository Template[3]

太棒了,GitHub Review 代码能力小升级
GitHub-Repository-Templates

GitHub Repository Template 允许开发者将 GitHub 仓库标记为模板库,这样在创建新的 GitHub 仓库时,可以选择在该模板基础上进行创建,作用就是规范项目结构,快速创建项目。目前模板功能已向 GitHub 所有用户开放。

太棒了,GitHub Review 代码能力小升级
doc-template

GitHub Unlimited Free Private Repositories[4]

太棒了,GitHub Review 代码能力小升级
pricing-social

在今年 1 月份,GitHub 就对外发出重磅消息,允许开发者无限创建个人私仓。要知道,以前若想在 GitHub 创建私有仓库,必须付费才行,如今完全放开了,真应该感谢 GitHub,感谢微软。

你还知道 GitHub 哪些好用的功能?

References

[1] GitHub Actions: https://github.com/features/actions[2] GitHub Package Registry: https://github.com/features/package-registry[3] GitHub Repository Template: https://help.github.com/en/articles/creating-a-template-repository[4] GitHub Unlimited Free Private Repositories: https://github.blog/2019-01-07-new-year-new-github/

太棒了,GitHub Review 代码能力小升级

相关文章:

  • 2022-02-10
  • 2021-12-12
  • 2022-01-30
  • 2022-12-23
  • 2021-04-09
  • 2021-07-22
  • 2021-11-11
  • 2021-10-28
猜你喜欢
  • 2021-10-16
  • 2021-07-17
  • 2021-12-23
  • 2021-08-13
  • 2021-12-06
  • 2021-05-25
相关资源
相似解决方案