Git

Git Commit 規則

每個階段完成後需建立一個 git commit,格式遵循 Conventional Commits:

1
<type>(<scope>): <subject>
欄位 規範
type feat / fix / refactor / perf / chore / docs / style / test
scope authrbacseeder
subject 祈使句現在式、不超過 72 字元、不加句號

cherry-pick + reset

適用情境: 某 commit 包含多檔修改,但你只要其中一個檔案。

流程:

1
2
3
4
git cherry-pick -n <commit-hash>   # 不立即 commit
git restore --staged . # 取消全部 staged
git add path/to/needed-file.php # 只加入想要的檔案
git commit

這樣等於「拆解 commit」。

原始問題(自然語言)
如何選定特定的git檔案做merge動作