快速开始
-
浏览列表
按使用频率整理的常用命令。
-
搜索
按命令名或说明过滤。
-
复制命令
粘贴到终端执行。
收录日常开发最常用的 Git 子命令:初始化、克隆、分支、合并、stash 与远程操作。支持搜索与一键复制,适合新手入门与老手偶尔忘命令时查阅。
隐私提示:本地解析,不上传服务器。
↓ 在下方输入区粘贴内容,结果会立即显示
常用 Git 命令速查; 搜索命令或说明,一键复制。
git initInitialize a new repository
git clone <url>Clone a remote repository
git statusShow working tree status
git add <file>Stage changes
git add .Stage all changes
git commit -m "msg"Commit staged changes
git pushPush commits to remote
git pullFetch and merge remote changes
git branchList branches
git branch <name>Create a branch
git checkout <branch>Switch branch
git switch <branch>Switch branch (newer)
git merge <branch>Merge branch into current
git log --onelineCompact commit history
git diffShow unstaged diff
git stashStash working changes
git stash popApply latest stash
git remote -vList remotes
git fetchDownload remote objects
git rebase <branch>Rebase onto branch
收录日常开发最常用的 Git 子命令; 完整选项见 git help 与官方文档。
收录日常开发最常用的 Git 子命令:初始化、克隆、分支、合并、stash 与远程操作。支持搜索与一键复制,适合新手入门与老手偶尔忘命令时查阅。
浏览列表
按使用频率整理的常用命令。
搜索
按命令名或说明过滤。
复制命令
粘贴到终端执行。
本页是速查表; 完整选项与参数说明请运行 git help <command>。
从克隆仓库开始:`git clone <url>` 将远程代码完整复制到本地。日常开发中,用 `git checkout -b feature-x` 创建新分支隔离修改。完成功能后,`git add .` 暂存所有变更,`git commit -m "message"` 提交,最后 `git push origin feature-x` 推送分支。
遇到紧急bug时,用 `git stash` 临时保存未提交的修改并清空工作区,切换到主分支修复。合并时,`git merge --no-ff` 保留分支历史,冲突用 `git mergetool` 可视化解决。定期执行 `git fetch --prune` 清理远程已删除分支的本地记录。
Input
git stash
Output
Stash working changes
聚焦日常操作; rebase -i、filter-branch 等见官方文档。
不需要,纯静态参考页。
可能使用了 `--depth=1` 浅克隆参数,这只会下载最新版本历史以节省空间。要获取完整历史,重新克隆时不加该参数,或对现有仓库执行 `git fetch --unshallow` 补全历史。