Git 速查表
git version 2.36.0
文档说明
<> 表示【需替换的项】
[] 表示【非必填项】
| 表示【或】
工作树(工作区),索引(暂存区),Git 目录(HEAD) 三词含义参照 Git 官网
初始配置
git config –global user.name [
git config –global user.email [
git config –global core.editor [
创建项目
git clone
git init [project] 初始化本地项目
添加
git add
git commit -m
git commit -am
git commit –amend -m
显示
git status 显示状态
git diff [HEAD] 显示差异
git log 显示日志
git show
git blame
撤回
git restore
git restore –staged
git reset [–mixed]
git reset –soft
git reset –hard
git rm
git mv
git clean -df 从工作区删除未跟踪的文件
分支
git branch [–list] 显示所有分支
git branch -a 显示远程分支
git branch
git branch -d|-D
git branch -m
git switch
git switch -c
git merge
git tag
git stash 将工作区的更改存储到脏工作目录中
git stash apply 将脏工作目录中的数据恢复到工作区(不会删除脏工作目录保存的数据)
git stash drop 将脏工作目录中的数据删除
git stash pop 将脏工作目录中的数据恢复工作区并删除脏数据
远程
git remote [-v] 显示远程库
git remote show
git remote add
git remote rm
git remote rename
git pull [
git push [-u
git push origin –delete
git fetch 从远程库获取到本地库
帮助
git help
git
checkout
该命令职责不明确,不建议使用;
git checkout
git checkout -f 强制丢弃工作区和暂存区的修改
git checkout
git checkout -b
————————————————
原文作者:晓飞
转自链接:https://learnku.com/articles/68324