GLM-4.6V-Flash-WEB模型能否用于宠物品种识别?
2026/1/5 19:26:29
Git 是一个分布式版本控制系统,由 Linus Torvalds 在 2005 年创建。它具有以下特点:
| 特性 | Git | SVN | CVS |
|---|---|---|---|
| 分布式 | ✅ | ❌ | ❌ |
| 离线工作 | ✅ | ❌ | ❌ |
| 分支成本 | 低 | 高 | 高 |
| 合并能力 | 强 | 中 | 弱 |
| 性能 | 高 | 中 | 低 |
# 设置用户信息(必需)gitconfig--globaluser.name"Your Name"gitconfig--globaluser.email"your.email@example.com"# 设置默认编辑器gitconfig--globalcore.editor"code --wait"# VS Codegitconfig--globalcore.editor"vim"# Vimgitconfig--globalcore.editor"nano"# Nano# 设置默认分支名gitconfig--globalinit.defaultBranch main# 设置行尾处理(Windows 推荐)gitconfig--globalcore.autocrlftrue# 设置行尾处理(macOS/Linux 推荐)gitconfig--globalcore.autocrlf input# 启用颜色输出gitconfig--globalcolor.ui auto# 设置别名gitconfig--globalalias.st statusgitconfig--globalalias.co checkoutgitconfig--globalalias.br branchgitconfig--globalalias.ci commitgitconfig--globalalias.unstage'reset HEAD --'gitconfig--globalalias.last'log -1 HEAD'gitconfig--globalalias.visual'!gitk'# 查看配置gitconfig--listgitconfig--global--listgitconfig user.name工作区 (Working Directory) ↓ git add 暂存区 (Staging Area/Index) ↓ git commit 版本库 (Repository)未跟踪 (Untracked) ──git add──→ 已暂存 (Staged) ↓ git commit 已跟踪 (Tracked) ←──────────────── 已提交 (Committed) ↓ 修改文件 ↑ 已修改 (Modified) ──git add──────────┘# 初始化新仓库gitinitgitinit my-projectgitinit--bare# 创建裸仓库(服务器用)# 克隆现有仓库gitclone https://github.com/user/repo.gitgitclone https://github.com/user/repo.git my-foldergitclone--depth1https://github.com/user/repo.git# 浅克隆gitclone--branchdevelop https://github.com/user/repo.git# 克隆特定分支# 查看仓库状态gitstatusgitstatus-s# 简短格式gitstatus--porcelain# 机器可读格式# 查看提交历史gitloggitlog--oneline# 单行显示gitlog--graph# 图形化显示gitlog--stat# 显示统计信息gitlog--patch# 显示详细差异gitlog-n5# 显示最近 5 次提交gitlog--since="2 weeks ago"# 时间过滤gitlog--author="John"# 作者过滤gitlog--grep="fix"# 提交信息过滤# 查看文件历史gitlog filenamegitlog-pfilename# 显示文件的详细变更历史# 查看分支图gitlog--graph--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'--abbrev-commit# 添加单个文件gitaddfilename.txt# 添加多个文件gitaddfile1.txt file2.txt# 添加所有文件gitadd.gitadd-Agitadd--all# 添加所有 .txt 文件gitadd*.txt# 交互式添加gitadd-igitadd-p# 部分添加(patch 模式)# 添加目录gitadddirectory/# 强制添加被忽略的文件gitadd-fignored-file.txt# 基本提交gitcommit-m"提交信息"# 详细提交信息gitcommit# 打开编辑器# 跳过暂存区直接提交gitcommit-a-m"提交信息"gitcommit-am"提交信息"# 修改最后一次提交gitcommit--amendgitcommit--amend-m"新的提交信息"gitcommit--amend--no-edit# 不修改提交信息# 空提交(用于触发 CI/CD)gitcommit --allow-empty-m"Empty commit"# 提交时签名gitcommit-S-m"Signed commit"# 查看工作区与暂存区的差异gitdiff# 查看暂存区与最后一次提交的差异gitdiff--stagedgitdiff--cached# 查看工作区与最后一次提交的差异gitdiffHEAD# 查看两个提交之间的差异gitdiffcommit1 commit2gitdiffHEAD~1 HEAD# 查看特定文件的差异gitdifffilenamegitdiff--stagedfilename# 查看统计信息gitdiff--statgitdiff--numstat# 查看单词级别的差异gitdiff--word-diff# 删除文件gitrmfilenamegitrm-ffilename# 强制删除gitrm--cachedfilename# 从暂存区删除但保留工作区文件# 删除目录gitrm-rdirectory/# 移动/重命名文件gitmvold-name new-namegitmvfile.txt directory/# 等价操作mvold-name new-namegitrmold-namegitaddnew-name# 查看分支gitbranch# 本地分支gitbranch-r# 远程分支gitbranch-a# 所有分支gitbranch-v# 显示最后一次提交gitbranch-vv# 显示跟踪关系# 创建分支gitbranch new-branchgitbranch new-branch commit-hash# 从特定提交创建# 切换分支gitcheckout branch-namegitswitch branch-name# Git 2.23+# 创建并切换分支gitcheckout-bnew-branchgitswitch-cnew-branch# Git 2.23+# 从远程分支创建本地分支gitcheckout-blocal-branch origin/remote-branchgitswitch-clocal-branch origin/remote-branch# 重命名分支gitbranch-mold-name new-namegitbranch-Mold-name new-name# 强制重命名# 删除分支gitbranch-dbranch-name# 安全删除gitbranch-Dbranch-name# 强制删除gitbranch--deletebranch-name# 删除远程分支gitpush origin--deletebranch-namegitpush origin :branch-name# 设置上游分支gitbranch --set-upstream-to=origin/maingitbranch-uorigin/main# 查看分支合并状态gitbranch--merged# 已合并的分支gitbranch --no-merged# 未合并的分支# 合并分支gitmerge branch-name# 快进合并gitmerge --ff-only branch-name# 禁用快进合并gitmerge --no-ff branch-name# 压缩合并gitmerge--squashbranch-name# 合并时指定提交信息gitmerge-m"Merge message"branch-name# 中止合并gitmerge--abort# 查看远程仓库gitremotegitremote-v# 显示详细信息# 添加远程仓库gitremoteaddorigin https://github.com/user/repo.gitgitremoteaddupstream https://github.com/original/repo.git# 修改远程仓库 URLgitremote set-url origin https://github.com/user/new-repo.git# 重命名远程仓库gitremoterenameorigin new-origin# 删除远程仓库gitremote remove origingitremotermorigin# 查看远程仓库信息gitremote show origin# 推送到远程仓库gitpush origin maingitpush origin branch-namegitpush-uorigin main# 设置上游并推送# 推送所有分支gitpush origin--all# 推送标签gitpush origin--tagsgitpush origin tag-name# 强制推送(危险操作)gitpush--forcegitpush --force-with-lease# 更安全的强制推送# 从远程仓库拉取gitpull origin maingitpull# 从跟踪的远程分支拉取# 拉取但不合并gitfetch origingitfetch--all# 拉取并变基gitpull--rebaseorigin main# 查看跟踪关系gitbranch-vv# 设置跟踪关系gitbranch --set-upstream-to=origin/main maingitbranch-uorigin/main main# 推送并设置跟踪gitpush-uorigin feature-branch# 删除远程跟踪分支gitbranch-drorigin/branch-name# 轻量标签gittag v1.0gittag v1.0 commit-hash# 附注标签gittag-av1.0-m"Version 1.0"gittag-av1.0 commit-hash-m"Version 1.0"# 签名标签gittag-sv1.0-m"Signed version 1.0"# 查看标签gittaggittag-l"v1.*"# 模式匹配# 查看标签信息gitshow v1.0# 删除标签gittag-dv1.0# 删除远程标签gitpush origin--deletetag v1.0gitpush origin :refs/tags/v1.0# 推送标签gitpush origin v1.0gitpush origin--tags# 检出标签gitcheckout v1.0gitcheckout-bversion1 v1.0# 基于标签创建分支Git 是一个功能强大的版本控制系统,掌握其基础用法对于现代软件开发至关重要。本指南仅涵盖基础操作部分,而Git 的学习是一个持续的过程,随着经验的积累,你会发现更多高效的使用方法和高级用法。