Compare commits

..

4 Commits

Author SHA1 Message Date
fcf90cc6df 添加 mergo.go
Some checks failed
Gitea Actions Demo / Initial System Checks (push) Has been cancelled
Gitea Actions Demo / Repository Setup (push) Has been cancelled
Gitea Actions Demo / Repository Inspection (push) Has been cancelled
2025-07-02 13:36:22 +08:00
d2cb8d7662 更新 test4
Some checks failed
Gitea Actions Demo / Initial System Checks (push) Has been cancelled
Gitea Actions Demo / Repository Setup (push) Has been cancelled
Gitea Actions Demo / Repository Inspection (push) Has been cancelled
2025-07-02 13:35:42 +08:00
88861a0549 更新 test3
Some checks are pending
Gitea Actions Demo / Initial System Checks (push) Waiting to run
Gitea Actions Demo / Repository Setup (push) Blocked by required conditions
Gitea Actions Demo / Repository Inspection (push) Blocked by required conditions
2025-07-02 13:35:15 +08:00
028612f6cc 添加 tmp/merge/tewtgogo.go
Some checks are pending
Gitea Actions Demo / Initial System Checks (push) Waiting to run
Gitea Actions Demo / Repository Setup (push) Blocked by required conditions
Gitea Actions Demo / Repository Inspection (push) Blocked by required conditions
2025-07-02 13:34:05 +08:00
8 changed files with 409 additions and 1559 deletions

81
mergo.go Normal file
View File

@ -0,0 +1,81 @@
{{if or .blobBase .blobHead}}
<tr>
<td colspan="2">
<div class="image-diff" data-path-before="{{.root.BeforeRawPath}}/{{PathEscapeSegments .file.OldName}}" data-path-after="{{.root.RawPath}}/{{PathEscapeSegments .file.Name}}">
<div class="ui secondary pointing tabular top attached borderless menu new-menu">
<div class="new-menu-inner">
<a class="item active" data-tab="diff-side-by-side-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.side_by_side"}}</a>
{{if and .blobBase .blobHead}}
<a class="item" data-tab="diff-swipe-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.swipe"}}</a>
<a class="item" data-tab="diff-overlay-{{.file.Index}}">{{.root.locale.Tr "repo.diff.image.overlay"}}</a>
{{end}}
</div>
</div>
<div class="gt-hidden">
<div class="ui bottom attached tab image-diff-container active" data-tab="diff-side-by-side-{{.file.Index}}">
<div class="diff-side-by-side">
{{if .blobBase}}
<span class="side">
<p class="side-header">{{.root.locale.Tr "repo.diff.file_before"}}</p>
<span class="before-container"><img class="image-before"></span>
<p>
<span class="bounds-info-before">
{{.root.locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span>
&nbsp;|&nbsp;
{{.root.locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
&nbsp;|&nbsp;
</span>
{{.root.locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .blobBase.Size}}</span>
</p>
</span>
{{end}}
{{if .blobHead}}
<span class="side">
<p class="side-header">{{.root.locale.Tr "repo.diff.file_after"}}</p>
<span class="after-container"><img class="image-after"></span>
<p>
<span class="bounds-info-after">
{{.root.locale.Tr "repo.diff.file_image_width"}}: <span class="text bounds-info-width"></span>
&nbsp;|&nbsp;
{{.root.locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
&nbsp;|&nbsp;
</span>
{{.root.locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .blobHead.Size}}</span>
</p>
</span>
{{end}}
</div>
</div>
{{if and .blobBase .blobHead}}
<div class="ui bottom attached tab image-diff-container" data-tab="diff-swipe-{{.file.Index}}">
<div class="diff-swipe">
<div class="swipe-frame">
<span class="before-container"><img class="image-before"></span>
<span class="swipe-container">
<span class="after-container"><img class="image-after"></span>
</span>
<span class="swipe-bar">
<span class="handle top-handle"></span>
<span class="handle bottom-handle"></span>
</span>
</div>
</div>
</div>
<div class="ui bottom attached tab image-diff-container" data-tab="diff-overlay-{{.file.Index}}">
<div class="diff-overlay">
<div class="overlay-frame">
<div class="ui centered">
<input type="range" min="0" max="100" value="50">
</div>
<span class="before-container"><img class="image-before"></span>
<span class="after-container"><img class="image-after"></span>
</div>
</div>
</div>
{{end}}
</div>
<div class="ui active centered inline loader gt-mb-4"></div>
</div>
</td>
</tr>
{{end}}

57
test3
View File

@ -15,18 +15,51 @@ fds
af
asdfasdf
asdfasdf
asd
fas
df
asdf
asd
f
asdf
asd
f
asdf
asd
fas
a{{if and $.root.SignedUserID (not $.Repository.IsArchived)}}
<form class="ui form {{if $.hidden}}gt-hidden comment-form{{end}}" action="{{$.root.Issue.Link}}/files/reviews/comments" method="post">
{{$.root.CsrfTokenHtml}}
<input type="hidden" name="origin" value="{{if $.root.PageIsPullFiles}}diff{{else}}timeline{{end}}">
<input type="hidden" name="latest_commit_id" value="{{$.root.AfterCommitID}}">
<input type="hidden" name="side" value="{{if $.Side}}{{$.Side}}{{end}}">
<input type="hidden" name="line" value="{{if $.Line}}{{$.Line}}{{end}}">
<input type="hidden" name="path" value="{{if $.File}}{{$.File}}{{end}}">
<input type="hidden" name="diff_start_cid">
<input type="hidden" name="diff_end_cid">
<input type="hidden" name="diff_base_cid">
{{template "shared/combomarkdowneditor" (dict
"locale" $.root.locale
"MarkdownPreviewUrl" (print $.root.Repository.Link "/markup")
"MarkdownPreviewContext" $.root.RepoLink
"TextareaName" "content"
"TextareaPlaceholder" ($.locale.Tr "repo.diff.comment.placeholder")
"DropzoneParentContainer" "form"
"DisableAutosize" "true"
)}}
<div class="field footer gt-mx-3">
<span class="markup-info">{{svg "octicon-markup"}} {{$.root.locale.Tr "repo.diff.comment.markdown_info"}}</span>
<div class="ui right">
{{if $.reply}}
<button class="ui submit green tiny button btn-reply" type="submit">{{$.root.locale.Tr "repo.diff.comment.reply"}}</button>
<input type="hidden" name="reply" value="{{$.reply}}">
<input type="hidden" name="single_review" value="true">
{{else}}
{{if $.root.CurrentReview}}
<button name="pending_review" type="submit" class="ui submit green tiny button btn-add-comment">{{$.root.locale.Tr "repo.diff.comment.add_review_comment"}}</button>
{{else}}
<button name="pending_review" type="submit" class="ui submit green tiny button btn-start-review">{{$.root.locale.Tr "repo.diff.comment.start_review"}}</button>
<button name="single_review" value="true" type="submit" class="ui submit tiny basic button btn-add-single">{{$.root.locale.Tr "repo.diff.comment.add_single_comment"}}</button>
{{end}}
{{end}}
{{if or (not $.HasComments) $.hidden}}
<button type="button" class="ui submit tiny basic button btn-cancel cancel-code-comment">{{$.root.locale.Tr "cancel"}}</button>
{{end}}
</div>
</div>
</form>
{{end}}
df
asd
fa

60
test4
View File

@ -1 +1,59 @@
test
test
<tr>
<td>
{{$result := call .root.CreateCsvDiff .file .blobBase .blobHead}}
{{if $result.Error}}
<div class="ui center">{{$result.Error}}</div>
{{else if $result.Sections}}
<table class="data-table">
{{range $i, $section := $result.Sections}}
<tbody {{if gt $i 0}}class="section"{{end}}>
{{range $j, $row := $section.Rows}}
<tr>
{{if and (eq $i 0) (eq $j 0)}}
<th class="line-num">{{.RowIdx}}</th>
{{range $j, $cell := $row.Cells}}
{{if not $cell}}
<th></th>
{{else if eq $cell.Type 2}}
<th class="modified"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></th>
{{else if eq $cell.Type 3}}
<th class="added"><span class="added-code">{{.RightCell}}</span></th>
{{else if eq $cell.Type 4}}
<th class="removed"><span class="removed-code">{{.LeftCell}}</span></th>
{{else if eq $cell.Type 5}}
<th class="moved">{{.RightCell}}</th>
{{else if eq $cell.Type 6}}
<th class="moved"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></th>
{{else}}
<th>{{.RightCell}}</th>
{{end}}
{{end}}
{{else}}
<td class="line-num">{{if .RowIdx}}{{.RowIdx}}{{end}}</td>
{{range $j, $cell := $row.Cells}}
{{if not $cell}}
<td></td>
{{else if eq $cell.Type 2}}
<td class="modified"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></td>
{{else if eq $cell.Type 3}}
<td class="added"><span class="added-code">{{.RightCell}}</span></td>
{{else if eq $cell.Type 4}}
<td class="removed"><span class="removed-code">{{.LeftCell}}</span></td>
{{else if eq $cell.Type 5}}
<td class="moved">{{.RightCell}}</td>
{{else if eq $cell.Type 6}}
<td class="moved"><span class="removed-code">{{.LeftCell}}</span> <span class="added-code">{{.RightCell}}</span></td>
{{else}}
<td>{{.RightCell}}</td>
{{end}}
{{end}}
{{end}}
</tr>
{{end}}
</tbody>
{{end}}
</table>
{{end}}
</td>
</tr>

View File

@ -1,5 +0,0 @@
需要应用测试补丁的作用?
需要应用测试补丁的作用?
需要应用测试补丁的作用?

299
testpr
View File

@ -1,299 +0,0 @@
已经变得迟钝,好久没有开启一个全新的学习模式了?
ai agent and so on
测试初始化,同时测试更新设置仓库。
vvmerge
pulls_default_merge_style
3. 为什么必须加 return
ctx.Error() 仅负责 “写入响应”,不负责 “终止函数”。为了确保错误响应被客户端正确接收,必须用 return 终止后续代码执行,避免响应被覆盖。
2. 无需 return 的原因:函数自然结束
若 ctx.Status() 是函数的最后一行代码,执行后函数会自然结束(退出),不会有后续代码覆盖响应。
示例中ctx.Status(http.StatusNoContent) 之后没有其他响应相关代码,因此无需 return。
如果考虑到结束与否,需要考虑加还是不加。
#哪些值得推荐得开源项目:
1. https://github.com/jwasham/coding-interview-university
2. https://github.com/trimstray/the-book-of-secret-knowledge.git
3. # GitHub stars > 100K 项目(按 stars 倒序,部分列举)
| 项目名 | stars | 链接 |
|---|---|---|
| freeCodeCamp | 423,229 | [freeCodeCamp](https://github.com/freeCodeCamp/freeCodeCamp) |
| build-your-own-x | 400,942 | [build-your-own-x](https://github.com/codecrafters-io/build-your-own-x) |
| awesome | 382,745 | [awesome](https://github.com/sindresorhus/awesome) |
| free-programming-books | 363,058 | [free-programming-books](https://github.com/EbookFoundation/free-programming-books) |
| public-apis | 356,647 | [public-apis](https://github.com/public-apis/public-apis) |
| developer-roadmap | 331,538 | [developer-roadmap](https://github.com/kamranahmedse/developer-roadmap) |
| coding-interview-university | 322,843 | [coding-interview-university](https://github.com/jwasham/coding-interview-university) |
| system-design-primer | 311,425 | [system-design-primer](https://github.com/donnemartin/system-design-primer) |
| 996.ICU | 273,605 | [996.ICU](https://github.com/996icu/996.ICU) |
| awesome-python | 250,541 | [awesome-python](https://github.com/vinta/awesome-python) |
| react | 237,349 | [react](https://github.com/facebook/react) |
| awesome-selfhosted | 236,726 | [awesome-selfhosted](https://github.com/awesome-selfhosted/awesome-selfhosted) |
| project-based-learning | 235,537 | [project-based-learning](https://github.com/practical-tutorials/project-based-learning) |
| vue | 209,158 | [vue](https://github.com/vuejs/vue) |
| Python | 202,942 | [Python](https://github.com/TheAlgorithms/Python) |
| linux | 197,766 | [linux](https://github.com/torvalds/linux) |
| javascript-algorithms | 192,191 | [javascript-algorithms](https://github.com/trekhleb/javascript-algorithms) |
| tensorflow | 190,768 | [tensorflow](https://github.com/tensorflow/tensorflow) |
| computer-science | 188,318 | [computer-science](https://github.com/ossu/computer-science) |
| You-Dont-Know-JS | 182,679 | [You-Dont-Know-JS](https://github.com/getify/You-Dont-Know-JS) |
| CS-Notes | 181,006 | [CS-Notes](https://github.com/CyC2018/CS-Notes) |
| ohmyzsh | 180,013 | [ohmyzsh](https://github.com/ohmyzsh/ohmyzsh) |
| the-book-of-secret-knowledge | 178,381 | [the-book-of-secret-knowledge](https://github.com/trimstray/the-book-of-secret-knowledge) |
| AutoGPT | 176,971 | [AutoGPT](https://github.com/Significant-Gravitas/AutoGPT) |
| vscode | 174,622 | [vscode](https://github.com/microsoft/vscode) |
| bootstrap | 172,528 | [bootstrap](https://github.com/twbs/bootstrap) |
| flutter | 171,430 | [flutter](https://github.com/flutter/flutter) |
| Python-100-Days | 169,324 | [Python-100-Days](https://github.com/jackfrued/Python-100-Days) |
| gitignore | 168,040 | [gitignore](https://github.com/github/gitignore) |
| the-art-of-command-line | 157,094 | [the-art-of-command-line](https://github.com/jlevy/the-art-of-command-line) |
| stable-diffusion-webui | 154,566 | [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui) |
| JavaGuide | 150,840 | [JavaGuide](https://github.com/Snailclimb/JavaGuide) |
| awesome-go | 147,525 | [awesome-go](https://github.com/avelino/awesome-go) |
| javascript | 147,076 | [javascript](https://github.com/airbnb/javascript) |
| transformers | 147,050 | [transformers](https://github.com/huggingface/transformers) |
| ollama | 146,725 | [ollama](https://github.com/ollama/ollama) |
| Microsoft-Activation-Scripts | 141,689 | [Microsoft-Activation-Scripts](https://github.com/massgravel/Microsoft-Activation-Scripts) |
| youtube-dl | 136,519 | [youtube-dl](https://github.com/ytdl-org/youtube-dl) |
| next.js | 133,226 | [next.js](https://github.com/vercel/next.js) |
| awesome-chatgpt-prompts | 130,747 | [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts) |
| go | 128,919 | [go](https://github.com/golang/go) |
| fucking-algorithm | 128,585 | [fucking-algorithm](https://github.com/labuladong/fucking-algorithm) |
| tech-interview-handbook | 127,679 | [tech-interview-handbook](https://github.com/yangshun/tech-interview-handbook) |
| scrcpy | 125,194 | [scrcpy](https://github.com/Genymobile/scrcpy) |
| 30-seconds-of-code | 124,585 | [30-seconds-of-code](https://github.com/Chalarangelo/30-seconds-of-code) |
| react-native | 123,055 | [react-native](https://github.com/facebook/react-native) |
| HelloGitHub | 121,740 | [HelloGitHub](https://github.com/521xueweihan/HelloGitHub) |
| PowerToys | 120,925 | [PowerToys](https://github.com/microsoft/PowerToys) |
| n8n | 119,094 | [n8n](https://github.com/n8n-io/n8n) |
| yt-dlp | 119,075 | [yt-dlp](https://github.com/yt-dlp/yt-dlp) |
| electron | 117,482 | [electron](https://github.com/electron/electron) |
| kubernetes | 116,356 | [kubernetes](https://github.com/kubernetes/kubernetes) |
| free-programming-books-zh_CN | 114,666 | [free-programming-books-zh_CN](https://github.com/justjavac/free-programming-books-zh_CN) |
| hello-algo | 114,417 | [hello-algo](https://github.com/krahets/hello-algo) |
| node | 112,219 | [node](https://github.com/nodejs/node) |
| langchain | 111,629 | [langchain](https://github.com/langchain-ai/langchain) |
| d3 | 111,063 | [d3](https://github.com/d3/d3) |
| three.js | 107,650 | [three.js](https://github.com/mrdoob/three.js) |
| dify | 107,304 | [dify](https://github.com/langgenius/dify) |
| axios | 107,228 | [axios](https://github.com/axios/axios) |
| free-for-dev | 106,015 | [free-for-dev](https://github.com/ripienaar/free-for-dev) |
| TypeScript | 105,262 | [TypeScript](https://github.com/microsoft/TypeScript) |
| rust | 105,089 | [rust](https://github.com/rust-lang/rust) |
| excalidraw | 103,686 | [excalidraw](https://github.com/excalidraw/excalidraw) |
| deno | 103,601 | [deno](https://github.com/denoland/deno) |
| nodebestpractices | 103,388 | [nodebestpractices](https://github.com/goldbergyoni/nodebestpractices) |
| create-react-app | 103,364 | [create-react-app](https://github.com/facebook/create-react-app) |
| open-webui | 102,874 | [open-webui](https://github.com/open-webui/open-webui) |
| GitHub-Chinese-Top-Charts | 100,339 | [GitHub-Chinese-Top-Charts](https://github.com/GrowingGit/GitHub-Chinese-Top-Charts) |
> 统计时间2025-07-17
# GitHub forks > 50K 项目(按 forks 倒序,部分列举)
| 项目名 | forks | stars | 链接 |
|---|---|---|---|
| datasharing | 243,623 | 6,620 | [datasharing](https://github.com/jtleek/datasharing) |
| Spoon-Knife | 152,208 | 13,104 | [Spoon-Knife](https://github.com/octocat/Spoon-Knife) |
| ProgrammingAssignment2 | 144,008 | 857 | [ProgrammingAssignment2](https://github.com/rdpeng/ProgrammingAssignment2) |
| SmartThingsPublic | 89,042 | 2,607 | [SmartThingsPublic](https://github.com/SmartThingsCommunity/SmartThingsPublic) |
| first-contributions | 88,431 | 49,385 | [first-contributions](https://github.com/firstcontributions/first-contributions) |
| Complete-Python-3-Bootcamp | 87,015 | 28,657 | [Complete-Python-3-Bootcamp](https://github.com/Pierian-Data/Complete-Python-3-Bootcamp) |
| gitignore | 83,058 | 168,040 | [gitignore](https://github.com/github/gitignore) |
| css-exercises | 81,817 | 1,889 | [css-exercises](https://github.com/TheOdinProject/css-exercises) |
| coding-interview-university | 79,614 | 322,843 | [coding-interview-university](https://github.com/jwasham/coding-interview-university) |
| bootstrap | 79,106 | 172,528 | [bootstrap](https://github.com/twbs/bootstrap) |
| freeCodeCamp | 36,698 | 423,229 | [freeCodeCamp](https://github.com/freeCodeCamp/freeCodeCamp) |
| tensorflow | 28,836 | 190,768 | [tensorflow](https://github.com/tensorflow/tensorflow) |
| vue | 34,690 | 209,158 | [vue](https://github.com/vuejs/vue) |
| react | 44,343 | 237,349 | [react](https://github.com/facebook/react) |
| awesome | 45,134 | 382,745 | [awesome](https://github.com/sindresorhus/awesome) |
> 统计时间2025-07-17
> 仅部分项目 forks 超过 50K实际数量有限。
> 如需查看更多结果,可访问 [GitHub forks 排序搜索](https://github.com/search?q=forks:%3E50000&sort=forks&order=desc)。
> 统计时间2025-07-17
> 目前只有少数项目 forks 超过 100K其他大多数项目未达到该数量级。
> 如需查看更多结果,可访问 [GitHub forks 排序搜索](https://github.com/search?q=forks:%3E100000&sort=forks&order=desc)。
使用 git rm --cached 只会从索引中移除文件,而不会删除工作目录中的文件,这样你仍然可以在本地使用它。
一旦文件被移除并提交后,根据 .gitignore 文件中的规则,该文件将被忽略,今后不会被包含在版本控制中
https://git-scm.com/book/en/v2
有时间看完所有得基础命令使用和对应得协议的学习
四种协议的问题:
还是没有明白通过git协议的案例比如我clone github上面显示了 https/http 和ssh 协议文件系统协议分享也理解但是还有什么场景是git协议直接使用的说得不够明白
安全性:
SSH提供加密和身份验证适合处理敏感信息。
Git协议只用于开放访问避免敏感数据
### 以下是一些使用Git协议的公共开源项目的案例您可以用来验证和测试
### 公共镜像项目示例
1. **Linux内核**
- **克隆命令**
```bash
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
```
- **验证**:访问[Linux内核Git仓库](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git)。
使用了SSH协议的对比
命令 git clone git@github.com:github/gitignore.git 使用的是 SSH协议。以下是原因和相关解释
2. **GNU项目**
- **克隆命令**
```bash
git clone git://git.savannah.gnu.org/emacs.git
```
- **验证**:访问[GNU Emacs Git仓库](https://git.savannah.gnu.org/git/emacs.git)。
![git协议无需通过密码等校验](image-75.png)
3. **Git本身**
- **克隆命令**
```bash
git clone git://git.kernel.org/pub/scm/git/git.git
```
- **验证**:访问[Git源代码仓库](https://git.kernel.org/pub/scm/git/git.git)。
### 使用Git协议的特点
- **无身份验证**:通过`git://`协议,不需要输入用户名或密码。
- **快速克隆**:适合快速获取公共开源项目,能够提高开发者的提取效率。
### 注意事项
使用Git协议时请注意该协议不提供安全性。它主要用于开放和公共项目因此敏感信息或需要权限控制的项目应使用SSH或HTTPS协议进行访问。
git和ssh的协议本身如何学习了解以及对比为什么ssh可以支持安全性git协议无法做到
对于开发者来说,规范且清晰的 `git commit` 提示和 `push` 内容介绍能极大提升团队协作效率和代码维护性。以下从规范指南、工具推荐和开源项目示例三个方面展开,帮助你更好地实践。
### 一、`git commit` 提示与 `push` 内容的规范指南
https://www.conventionalcommits.org/en/v1.0.0/#specification
#### 1. `git commit` 提示的核心原则
- **结构化**:遵循固定格式(如类型+范围+描述),方便自动化工具解析和历史检索。
- **简洁明确**标题通常不超过50字符正文补充细节如动机、解决的问题、与其他修改的关联
- **语义化**通过动词和类型区分修改性质如新增功能、修复bug、重构代码
常见的规范格式(以 [Conventional Commits](https://www.conventionalcommits.org/) 为例:
```
<类型>[可选 范围]: <描述>
[可选 正文]
[可选 脚注]
```
- **类型**`feat`(新功能)、`fix`bug修复、`docs`(文档)、`style`(格式调整,不影响代码逻辑)、`refactor`(重构)、`test`(测试相关)、`chore`(构建/依赖等杂项)。
- **范围**:可选,说明修改涉及的模块(如 `auth`、`api`)。
- **描述**:简洁描述修改内容,使用祈使句(如“添加用户登录验证”而非“添加了用户登录验证”)。
示例:
```
feat(auth): 实现手机号验证码登录功能
- 新增验证码发送接口
- 完善登录状态存储逻辑
- 修复验证码过期时间计算错误
Closes #123
```
#### 2. `git push` 内容介绍的注意事项
`push` 通常是将本地提交推送到远程仓库如PR/MR描述内容应
- 关联相关提交:汇总本次推送包含的关键 `commit` 信息(可通过 `git log` 简洁提炼)。
- 说明上下文如“本次推送包含3个提交主要解决了XX模块的性能问题具体见各commit详情”。
- 关联任务/Issue通过关键词如 `Fixes #456`)关联项目管理工具中的任务,自动触发状态更新。
### 二、辅助工具推荐
#### 1. 规范 `commit` 提示的工具
- **commitizen**:交互式命令行工具,引导你按规范填写 `commit` 信息,支持自定义配置。
仓库:[commitizen/cz-cli](https://github.com/commitizen/cz-cli)
使用:安装后用 `git cz` 替代 `git commit`,按提示选择类型、输入描述等。
- **commitlint**:校验 `commit` 信息是否符合规范,可集成到 `git hook` 中(如配合 `husky`),避免不规范提交。
仓库:[conventional-changelog/commitlint](https://github.com/conventional-changelog/commitlint)
- **husky**:管理 `git hook` 的工具,可在 `commit-msg` 阶段自动调用 `commitlint` 校验,在 `pre-commit` 阶段执行代码格式化/ lint 等。
仓库:[typicode/husky](https://github.com/typicode/husky)
#### 2. 自动生成 `commit` 日志的工具
- **standard-version**:根据 `Conventional Commits` 自动生成CHANGELOG、更新版本号适合语义化版本SemVer管理。
仓库:[conventional-changelog/standard-version](https://github.com/conventional-changelog/standard-version)
- **release-please**Google 开源的自动发布工具,基于 `commit` 信息生成PR自动更新版本和CHANGELOG。
仓库:[googleapis/release-please](https://github.com/googleapis/release-please)
### 三、遵循规范的开源项目示例(可参考其 `commit` 历史)
以下项目的 `commit` 信息和PR描述堪称典范可直接查看其 `git log` 或PR列表学习
1. **Vue.js**
仓库:[vuejs/vue](https://github.com/vuejs/vue)
特点:严格遵循语义化提交,类型清晰(如 `fix(compiler)`、`feat(reactivity)`),正文补充修改细节。
2. **React**
仓库:[facebook/react](https://github.com/facebook/react)
特点提交信息简洁且关联IssuePR描述详细包含测试步骤、实现思路
3. **TypeScript**
仓库:[microsoft/TypeScript](https://github.com/microsoft/TypeScript)
特点:类型明确(如 `refactor`、`test`),脚注常用 `Fixes #xxx` 关联问题。
4. **Angular**
仓库:[angular/angular](https://github.com/angular/angular)
特点:早期推广 `Conventional Commits` 的代表项目,规范极其严格,包含范围和详细正文。
5. **Vite**
仓库:[vitejs/vite](https://github.com/vitejs/vite)
特点提交信息简洁有力PR描述会汇总关联的 `commit` 并说明影响。
6. **ESLint**
仓库:[eslint/eslint](https://github.com/eslint/eslint)
特点commit类型细分如 `docs: update README`、`chore: upgrade dependencies`PR关联Issue并说明解决方案。
7. **Docker**
仓库:[docker/docker](https://github.com/docker/docker)
特点提交描述侧重“做了什么”和“为什么做”PR包含测试用例和兼容性说明。
### 四、总结
- 从规范入手:优先采用 `Conventional Commits` 等成熟标准,确保团队统一。
- 工具提效:用 `commitizen` 降低手动编写成本,用 `commitlint + husky` 强制规范,用 `standard-version` 自动生成日志。
- 参考优秀项目:通过阅读开源项目的 `commit` 历史和PR描述模仿其简洁、清晰、结构化的表达方式。
通过这些方法,既能提升自己的代码管理习惯,也能让团队协作更顺畅。
Closes #123 是 Git 协作中(尤其在 GitHub、GitLab 等平台)用于关联并自动关闭 Issue的关键字语法其中 #123 对应的是Issue 编号,而非 PR 编号
做开源和内部项目的bug管理系统的完整体验。代码管理方便了开发者禅道类似工具方便了项目经理是吧
Closes #123 是 “告诉平台:当 PR 合并后,自动关闭 Issue #123”操作主体是平台
开发者始终可以手动关闭 / 开启 Issue两种方式并不冲突例如如果 Issue 无需代码变更即可解决,直接手动关闭更高效)

1242
testsync

File diff suppressed because it is too large Load Diff

224
tmp/merge/tewtgogo.go Normal file
View File

@ -0,0 +1,224 @@
<div>
<div class="diff-detail-box diff-box sticky gt-df gt-sb gt-ac gt-fw">
<div class="gt-df gt-ac gt-fw">
{{if not .DiffNotAvailable}}
<button class="diff-toggle-file-tree-button gt-df gt-ac not-mobile" data-show-text="{{.locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{.locale.Tr "repo.diff.hide_file_tree"}}">
{{/* the icon meaning is reversed here, "octicon-sidebar-collapse" means show the file tree */}}
{{svg "octicon-sidebar-collapse" 20 "icon gt-hidden"}}
{{svg "octicon-sidebar-expand" 20 "icon gt-hidden"}}
</button>
<script>
// Default to true if unset
const diffTreeVisible = localStorage?.getItem('diff_file_tree_visible') !== 'false';
const diffTreeBtn = document.querySelector('.diff-toggle-file-tree-button');
const diffTreeIcon = `.octicon-sidebar-${diffTreeVisible ? 'expand' : 'collapse'}`;
diffTreeBtn.querySelector(diffTreeIcon).classList.remove('gt-hidden');
diffTreeBtn.setAttribute('data-tooltip-content', diffTreeBtn.getAttribute(diffTreeVisible ? 'data-hide-text' : 'data-show-text'));
</script>
<div class="diff-detail-stats gt-df gt-ac gt-fw">
{{svg "octicon-diff" 16 "gt-mr-2"}}{{.locale.Tr "repo.diff.stats_desc" .Diff.NumFiles .Diff.TotalAddition .Diff.TotalDeletion | Str2html}}
</div>
{{end}}
</div>
<div class="diff-detail-actions gt-df gt-ac gt-gap-2 gt-fw">
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived) (not .DiffNotAvailable)}}
<div class="gt-df gt-ac gt-fc gt-whitespace-nowrap gt-mr-2">
<label for="viewed-files-summary" id="viewed-files-summary-label" data-text-changed-template="{{.locale.Tr "repo.pulls.viewed_files_label"}}">
{{.locale.Tr "repo.pulls.viewed_files_label" .Diff.NumViewedFiles .Diff.NumFiles}}
</label>
<progress id="viewed-files-summary" value="{{.Diff.NumViewedFiles}}" max="{{.Diff.NumFiles}}"></progress>
</div>
{{end}}
{{template "repo/diff/whitespace_dropdown" .}}
{{template "repo/diff/options_dropdown" .}}
{{if and .PageIsPullFiles $.SignedUserID (not .IsArchived)}}
{{template "repo/diff/new_review" .}}
{{end}}
</div>
</div>
{{if not .DiffNotAvailable}}
<script id="diff-data-script" type="module">
const diffDataFiles = [{{range $i, $file := .Diff.Files}}{Name:"{{$file.Name}}",NameHash:"{{$file.NameHash}}",Type:{{$file.Type}},IsBin:{{$file.IsBin}},Addition:{{$file.Addition}},Deletion:{{$file.Deletion}}},{{end}}];
const diffData = {
isIncomplete: {{.Diff.IsIncomplete}},
tooManyFilesMessage: "{{$.locale.Tr "repo.diff.too_many_files"}}",
binaryFileMessage: "{{$.locale.Tr "repo.diff.bin"}}",
showMoreMessage: "{{.locale.Tr "repo.diff.show_more"}}",
statisticsMessage: "{{.locale.Tr "repo.diff.stats_desc_file"}}",
linkLoadMore: "{{$.Link}}?skip-to={{.Diff.End}}&file-only=true",
};
// for first time loading, the diffFileInfo is a plain object
// after the Vue component is mounted, the diffFileInfo is a reactive object
// keep in mind that this script block would be executed many times when loading more files, by "loadMoreFiles"
let diffFileInfo = window.config.pageData.diffFileInfo || {
files:[],
fileTreeIsVisible: false,
fileListIsVisible: false,
isLoadingNewData: false,
selectedItem: '',
};
diffFileInfo = Object.assign(diffFileInfo, diffData);
diffFileInfo.files.push(...diffDataFiles);
window.config.pageData.diffFileInfo = diffFileInfo;
</script>
<div id="diff-file-list"></div>
{{end}}
<div id="diff-container">
{{if .DiffNotAvailable}}
<h4>{{.locale.Tr "repo.diff.data_not_available"}}</h4>
{{else}}
<div id="diff-file-tree" class="gt-hidden"></div>
<script>
if (diffTreeVisible) document.getElementById('diff-file-tree').classList.remove('gt-hidden');
</script>
<div id="diff-file-boxes" class="sixteen wide column">
{{range $i, $file := .Diff.Files}}
{{/*notice: the index of Diff.Files should not be used for element ID, because the index will be restarted from 0 when doing load-more for PRs with a lot of files*/}}
{{$blobBase := call $.GetBlobByPathForCommit $.BeforeCommit $file.OldName}}
{{$blobHead := call $.GetBlobByPathForCommit $.HeadCommit $file.Name}}
{{$isImage := or (call $.IsBlobAnImage $blobBase) (call $.IsBlobAnImage $blobHead)}}
{{$isCsv := (call $.IsCsvFile $file)}}
{{$showFileViewToggle := or $isImage (and (not $file.IsIncomplete) $isCsv)}}
{{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}
{{$isReviewFile := and $.IsSigned $.PageIsPullFiles (not $.IsArchived)}}
<div class="diff-file-box diff-box file-content {{TabSizeClass $.Editorconfig $file.Name}} gt-mt-3" id="diff-{{$file.NameHash}}" data-old-filename="{{$file.OldName}}" data-new-filename="{{$file.Name}}" {{if or ($file.ShouldBeHidden) (not $isExpandable)}}data-folded="true"{{end}}>
<h4 class="diff-file-header sticky-2nd-row ui top attached normal header gt-df gt-ac gt-sb gt-fw">
<div class="diff-file-name gt-df gt-ac gt-gap-2 gt-fw">
<button class="fold-file btn interact-bg gt-p-2{{if not $isExpandable}} gt-invisible{{end}}">
{{if $file.ShouldBeHidden}}
{{svg "octicon-chevron-right" 18}}
{{else}}
{{svg "octicon-chevron-down" 18}}
{{end}}
</button>
<div class="gt-font-semibold gt-df gt-ac gt-mono">
{{if $file.IsBin}}
<span class="gt-ml-1 gt-mr-3">
{{$.locale.Tr "repo.diff.bin"}}
</span>
{{else}}
{{template "repo/diff/stats" dict "file" . "root" $}}
{{end}}
</div>
<span class="file gt-mono"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} &rarr; {{end}}{{$file.Name}}</a>{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}}</span>
<button class="btn interact-fg gt-p-3" data-clipboard-text="{{$file.Name}}">{{svg "octicon-copy" 14}}</button>
{{if $file.IsGenerated}}
<span class="ui label">{{$.locale.Tr "repo.diff.generated"}}</span>
{{end}}
{{if $file.IsVendored}}
<span class="ui label">{{$.locale.Tr "repo.diff.vendored"}}</span>
{{end}}
{{if and $file.Mode $file.OldMode}}
{{$old := $.locale.Tr ($file.ModeTranslationKey $file.OldMode)}}
{{$new := $.locale.Tr ($file.ModeTranslationKey $file.Mode)}}
<span class="gt-ml-4 gt-mono">{{$.locale.Tr "git.filemode.changed_filemode" $old $new}}</span>
{{else if $file.Mode}}
<span class="gt-ml-4 gt-mono">{{$.locale.Tr ($file.ModeTranslationKey $file.Mode)}}</span>
{{end}}
</div>
<div class="diff-file-header-actions gt-df gt-ac gt-gap-2 gt-fw">
{{if $showFileViewToggle}}
<div class="ui compact icon buttons">
<button class="ui tiny basic button file-view-toggle" data-toggle-selector="#diff-source-{{$file.NameHash}}" data-tooltip-content="{{$.locale.Tr "repo.file_view_source"}}">{{svg "octicon-code"}}</button>
<button class="ui tiny basic button file-view-toggle active" data-toggle-selector="#diff-rendered-{{$file.NameHash}}" data-tooltip-content="{{$.locale.Tr "repo.file_view_rendered"}}">{{svg "octicon-file"}}</button>
</div>
{{end}}
{{if $file.IsProtected}}
<span class="ui basic label">{{$.locale.Tr "repo.diff.protected"}}</span>
{{end}}
{{if and $isReviewFile $file.HasChangedSinceLastReview}}
<span class="changed-since-last-review unselectable not-mobile">{{$.locale.Tr "repo.pulls.has_changed_since_last_review"}}</span>
{{end}}
{{if not (or $file.IsIncomplete $file.IsBin $file.IsSubmodule)}}
<button class="ui basic tiny button unescape-button not-mobile">{{$.locale.Tr "repo.unescape_control_characters"}}</button>
<button class="ui basic tiny button escape-button gt-hidden">{{$.locale.Tr "repo.escape_control_characters"}}</button>
{{end}}
{{if and (not $file.IsSubmodule) (not $.PageIsWiki)}}
{{if $file.IsDeleted}}
<a class="ui basic tiny button" rel="nofollow" href="{{$.BeforeSourcePath}}/{{PathEscapeSegments .Name}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
{{else}}
<a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/{{PathEscapeSegments .Name}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
{{end}}
{{end}}
{{if $isReviewFile}}
<label data-link="{{$.Issue.Link}}/viewed-files" data-headcommit="{{$.AfterCommitID}}" class="viewed-file-form unselectable{{if $file.IsViewed}} viewed-file-checked-form{{end}}">
<input type="checkbox" name="{{$file.GetDiffFileName}}" autocomplete="off"{{if $file.IsViewed}} checked{{end}}> {{$.locale.Tr "repo.pulls.has_viewed_file"}}
</label>
{{end}}
</div>
</h4>
<div class="diff-file-body ui attached unstackable table segment" {{if $file.IsViewed}}data-folded="true"{{end}}>
<div id="diff-source-{{$file.NameHash}}" class="file-body file-code unicode-escaped code-diff{{if $.IsSplitStyle}} code-diff-split{{else}} code-diff-unified{{end}}{{if $showFileViewToggle}} gt-hidden{{end}}">
{{if or $file.IsIncomplete $file.IsBin}}
<div class="diff-file-body binary" style="padding: 5px 10px;">
{{if $file.IsIncomplete}}
{{if $file.IsIncompleteLineTooLong}}
{{$.locale.Tr "repo.diff.file_suppressed_line_too_long"}}
{{else}}
{{$.locale.Tr "repo.diff.file_suppressed"}}
<a class="ui basic tiny button diff-load-button" data-href="{{$.Link}}?file-only=true&files={{$file.Name}}&files={{$file.OldName}}">{{$.locale.Tr "repo.diff.load"}}</a>
{{end}}
{{else}}
{{$.locale.Tr "repo.diff.bin_not_shown"}}
{{end}}
</div>
{{else}}
<table class="chroma" data-new-comment-url="{{$.Issue.Link}}/files/reviews/new_comment" data-path="{{$file.Name}}">
{{if $.IsSplitStyle}}
{{template "repo/diff/section_split" dict "file" . "root" $}}
{{else}}
{{template "repo/diff/section_unified" dict "file" . "root" $}}
{{end}}
</table>
{{end}}
</div>
{{if $showFileViewToggle}}
{{/* for image or CSV, it can have a horizontal scroll bar, there won't be review comment context menu (position absolute) which would be clipped by "overflow" */}}
<div id="diff-rendered-{{$file.NameHash}}" class="file-body file-code {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}} gt-overflow-x-scroll">
<table class="chroma gt-w-100">
{{if $isImage}}
{{template "repo/diff/image_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}}
{{else}}
{{template "repo/diff/csv_diff" dict "file" . "root" $ "blobBase" $blobBase "blobHead" $blobHead}}
{{end}}
</table>
</div>
{{end}}
</div>
</div>
{{end}}
{{if .Diff.IsIncomplete}}
<div class="diff-file-box diff-box file-content gt-mt-3" id="diff-incomplete">
<h4 class="ui top attached normal header gt-df gt-ac gt-sb">
{{$.locale.Tr "repo.diff.too_many_files"}}
<a class="ui basic tiny button" id="diff-show-more-files" data-href="{{$.Link}}?skip-to={{.Diff.End}}&file-only=true">{{.locale.Tr "repo.diff.show_more"}}</a>
</h4>
</div>
{{end}}
</div>
{{end}}
</div>
{{if and (not $.Repository.IsArchived) (not .DiffNotAvailable)}}
<template id="issue-comment-editor-template">
<div class="ui comment form">
{{template "shared/combomarkdowneditor" (dict
"locale" $.locale
"MarkdownPreviewUrl" (print $.Repository.Link "/markup")
"MarkdownPreviewContext" $.RepoLink
"TextareaName" "content"
"DropzoneParentContainer" ".ui.form"
)}}
<div class="text right edit buttons">
<button class="ui basic primary cancel button" tabindex="3">{{.locale.Tr "repo.issues.cancel"}}</button>
<button class="ui green save button" tabindex="2">{{.locale.Tr "repo.issues.save"}}</button>
</div>
</div>
</template>
{{end}}
{{if (not .DiffNotAvailable)}}
{{template "repo/issue/view_content/reference_issue_dialog" .}}
{{end}}
</div>