Start

git init 创建储存库

git clone URL 克隆到本地

git config --global user.name "newbiewood" 工作名称

git config --global user.email [email protected] 工作邮箱

git config --list 配置文件查看

Use

git reset 删去所有暂存缓存

git add 添加文件到暂存区 

git add . 将本目录下所有全部添加

git commit -m “描述” 提交到暂存库

git commit -a 将所有修改的文件一同提交不用add  

git commit —amend 修改最后一次提交  

git reset HEAD filename 取消文件暂存

git rm -f 强制从暂存区移除文件

git mv 可用于重命名

git remote add 添加远程仓库

git remote rename 重命名

git fetch 拉取当前与仓库没有的信息

git remote remove 移除远程库

git tag -a v1.0 -m “描述”

git push origin 将标签一同提交

git push origin --delete 远程仓库删掉标签

git pull — rebase 拉取

git config —global alias.<别名> 实际命令 ‘ ‘

git branch <branch_name> 创建分支

git checkout <branch_name> 切换至分支

git checkout -b <branch_name> 创建一个分支并切换至

git merge <branch_name> 合并分支

git mergetool 处理合并时的冲突分支

Look

git status 查看修改状态 -s 简短查看

git diff 更加详细的查看更改的内容

git diff --staged 与最后一次提交的做对比

git log -p 显示每次提交所引入的差异 

git log —stat 看每次提交的简略统计信息 

git remote -v 查看远程仓库

git tag -l 查看所有标签

git show 查看标签信息和与之对应的提交信息

git branch 查看当前的分支

忽略添加文件

编写 .gitignore

遵从正则表达式