深浅模式
设置用户信息
shell$ git config --global user.name "AL" # 设置用户名 $ git config --global user.email "1961154734@qq.com" #邮箱 $ git config --list #查看配置信息
创建仓库
本地
shellgit init git remote add origin <url>
远程仓库克隆
在控制面板/用户账户/凭据管理器/Windows 凭据/编辑gitee凭据,下修改账户密码
shellgit status #查看文件状态 git add * #将文件添加到暂存区
未跟踪状态
常用命令
shellgit reset #取消文件暂存区 git reset --hard <file> #切换版本 git add <file> #将指定文件添加到暂存区 git commit -m <提交描述><file> #将暂存区文件提交到版本库 git log #日志 git remote <-v> #查看远程仓库 git remote add <仓库别名origin> <仓库url> #添加远程仓库 git clone <url> #从远程仓库克隆 git pull/push # 拉取,提交
分支操作
shellgit branch [-r/a] #查看本地[远程/所有]分支 git branch [name] #创建分支 git checkout[name] #切换分支 git push [shortName][name] #推送分支到远程仓库 git merge [name] #合并分支
标签操作
shellgit tag #列出已有标签 git tag [name] #创建标签 git push[shortName][name] #将标签推送到远程仓库 git checkout -b [branch][name] #检出标签 git pull --rebase origin master