|-----------------------------------|---------------|
| 命令 | 描述 |
| git branch | 查看分支; |
| git branch 分支 | 创建分支; |
| git branch -D 分支 | 删除分支; |
| git checkout 分支 | 切换分支; |
| git checkout -B 分支 | 创建并切换分支; |
| git switch 分支 | 切换分支; |
| git switch -C 分支 | 创建并切换分支; |
| git log | 查看提交历史; |
| git reflog | 查看提交历史树状; |
| git reset --hard 版本 | 版本回退; |
| git config --global user.name | 查看git的用户名称; |
| git config --global user.name 名称 | 设置git的用户名称; |
| git config --global user.email | 查看git的用户邮箱; |
| git config --global user.email 邮箱 | 设置git的用户邮箱; |
| git status | 查看更改的文件状态; |
| git add . | 提交全部更改文件到缓存区; |
| git add 文件 | 提交指定更改文件到缓存区; |
| git commit -m "描述" | 提交到缓存区的描述; |
| git pull | 拉取远程仓库代码; |
| git push | 提交到远程仓库代码; |
| git remote -v | 查看远程仓库信息; |
| git remote add 远程仓库链接 | 本地连接远程仓库; |
| git remote add 远程仓库链接/origin | 本地连接并关联远程仓库; |
| git remote rm 远程仓库链接 | 本地删除远程仓库; |
git常用命令
前端小凯2024-09-12 22:45
相关推荐
今日无bug1 天前
Git 提交:用全栈技术打造智能 Commit Message 生成器明月_清风1 天前
拒绝盲目 Git:VS Code 神级插件 GitLens 的 9 个进效杀手锏goodspeed4 天前
Git Worktree:多分支并行开发的利器雮尘5 天前
让 AI Agent 高效并行开发的命令-git worktree南果梨6 天前
OpenClaw 完整教程!从安装到使用(官方脚本版)Selicens7 天前
git批量删除本地多余分支闲云一鹤8 天前
Git LFS 扫盲教程 - 你不会还在用 Git 管理大文件吧?vibecoding日记11 天前
为什么我就想要「线性历史 + Signed Commits」,GitHub 却把我当猴耍 🤬🎙️程序员小崔日记11 天前
如何将代码轻松上传到 Gitee?Git 使用全攻略!