跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 发现自己的 commit 标题和内容越来越长了

发表于
大概是从四年级还是五年级做自己的项目开始,感觉好像就隐隐约约有倾向想要在 commit 里面写越来越多东西。一开始只是写比如从哪个 Stackoverflow 讨论串找到的参考资料,后来到一些算法或者设计上的东西,然后发现自己的 commit 标题越来越长,感觉长过头了就写进了 message 里面,然后就在 message 里面写 markdown 了。

上班后感觉好像这个倾向又被强化了,一方面摸鱼写的代码的 commit 很容易一个 commit 里面覆盖多个内容,而不是像写自己的项目那样细粒度到一两个文件,另一方面又总是担心意图没解释清楚别人难以理解自己的代码。

所以 commit 有时候就会长这样:

```markdown

[Core] (fix) Sorting algorithm, XXX Page, YYY Service

- Designed an algorithm to sort a certain dataset according to some requirements and constraints
- Included this algorithm into XXX page
- Extracted several methods to YYY service
- Removed deprecated codes
- Added test suite for subjects mentioned above

The algorithm scans the incoming dataset, which should conform to ..., at a first pass, it will ...

Some code has been refactored and reformatted.
```

不过也不总是这么长就是,如果 commit 改变的东西不多的话,那倒是经常一两个 bullet 就完了。

另外也感觉发 PR 的时候好像我总喜欢写得像 GitHub 的 readme 一样。

不过也听说是不是说长 commit 是新手的普遍操作,senior 的 commit 普遍一句话带过。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.