使用步骤
- 搜索 Git 命令或任务,例如 branch 或 fetch。
- 查看匹配命令及简要说明。
- 复制后替换占位符,再在自己的仓库中执行。
常见问题
- 工具会执行 Git 命令吗?
- 不会。这是速查表,复制后在终端执行是单独操作。
- 重置前应该检查什么?
- 执行 git status,确认分支与未提交修改。某些重置方式会丢弃修改。
工具在当前浏览器中处理输入,不上传工具输入。
Git 常用命令速查,支持搜索与一键复制
git config --global user.name "姓名"设置用户名
git config --global user.email "email@example.com"设置邮箱
git config --list查看配置
git init初始化仓库
git clone <url>克隆仓库
git add <file>添加文件到暂存区
git add .添加所有修改
git commit -m "消息"提交
git status查看状态
git diff查看未暂存修改
git branch查看分支
git branch <name>创建分支
git checkout <branch>切换分支
git checkout -b <branch>创建并切换分支
git merge <branch>合并分支
git branch -d <branch>删除分支
git remote -v查看远程
git push origin <branch>推送到远程
git pull origin <branch>拉取远程
git fetch获取远程更新
git remote add origin <url>添加远程仓库
git reset --soft HEAD~1撤销上次提交(保留修改)
git reset --hard HEAD~1撤销上次提交(丢弃修改)
git checkout -- <file>撤销工作区修改
git stash暂存修改
git stash pop恢复暂存
git log查看提交历史
git log --oneline简洁历史
git show <commit>查看某次提交
git diff <branch1> <branch2>比较分支
工具在当前浏览器中处理输入,不上传工具输入。