协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
commit-changes【开发与工程】Stage, commit, and amend changes with conventional commit messages. Covers reviewing changes, selective staging, writing descriptive commit messages using HEREDOC format, and verifying commit history. Use when saving a logical unit of work to version control, creating a commit with a conventional message, amending the most recent commit, or reviewing…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
擇文件入列,書簡明之辭以提交,驗其錄之可徵。
察工作樹之狀、閱其差異。
# See which files are modified, staged, or untracked
git status
# See unstaged changes
git diff
# See staged changes
git diff --staged
得:凡已改、已列、未錄之文件皆了然。
敗則:若 git status 敗,驗所處是否為 git 庫內(git rev-parse --is-inside-work-tree)。
宜擇名而入之,勿濫用 git add . 或 git add -A,以防誤納密物或無關之變。
# Stage specific files by name
git add src/feature.R tests/test-feature.R
# Stage all changes in a specific directory
git add src/
# Stage parts of a file interactively (not supported in non-interactive contexts)
# git add -p filename
提交之前,察已入列者。
git diff --staged
得:所入者唯所欲之文件與變,無 .env、無憑據、無巨檔。
敗則:若誤入者,以 git reset HEAD <file> 出之。若密物已列,立時出之,勿提交。
依合範之式書之。辭必以 HEREDOC 傳,以全其格。
git commit -m "$(cat <<'EOF'
feat: add weighted mean calculation
Implements weighted_mean() with support for NA handling and
zero-weight filtering. Includes input validation for mismatched
vector lengths.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EOF
)"
合範之類:
| 類 | 用時 |
|---|---|
feat | 新功 |
fix | 修訛 |
docs | 獨書文檔 |
test | 增或更試 |
refactor | 變碼而不修不增 |
chore | 建構、CI、依賴之更 |
style | 修其形、空白(無邏輯之變) |
得:提交已立,辭敘其故,不徒述其形。
敗則:若提交前掛鈎敗,修其因,以 git add 再入列,立新提交(勿用 --amend,蓋敗之提交未嘗立也)。
唯前提交未推至共有之遠端,方可修之。
# Amend message only
git commit --amend -m "$(cat <<'EOF'
fix: correct weighted mean edge case for empty vectors
EOF
)"
# Amend with additional staged changes
git add forgotten-file.R
git commit --amend --no-edit
得:前提交原地已更。git log -1 示其修後之容。
敗則:若提交已推,勿修之。代之以新提交。強推已修之提交於共有之枝,致史分歧。
# View the last commit
git log -1 --stat
# View recent commit history
git log --oneline -5
# Verify the commit content
git show HEAD
得:提交現於史中,辭正、著者正、文件之變亦正。
敗則:若提交所含之文件有誤,以 git reset --soft HEAD~1 撤之而留其變於列,再正而提之。
.env)入庫git log 示提交附正確之屬git add .:必先察 git status。宜擇名而入之。--no-edit:補遺檔於前提交,宜用 --no-edit 以存舊辭。--amend:掛鈎敗則提交未立。用 --amend 反改前提交。掛鈎修後,必立新提交。manage-git-branches — 提交前之枝務create-pull-request — 提交後之下步resolve-git-conflicts — 合併或變基時解其衝突configure-git-repository — 庫之設與其範