创建仓库
git init
添加到暂存区
git add 文件
提交到仓库
git commit 文件
-m ‘注释’
工作区状态
git status
日志
git log
–pretty=noeline 漂亮的展示
历史版本
git reflog
版本 切换
git reset –hard 索引
工作区与暂存区比对
git diff
文件
HEAD或索引 暂存区与仓库比对 HEAD代表当前版本
创建分支
git branch 名称
-v 查看所有分支
切换分支
git checkout 名称
合并分支 合并后再次提交到仓库
git merge 分支
远程仓库
git remote
-v 查看远程仓库别名
add 名称 地址 起别名
推送到远程库
git pust 别名 分支
拉取远程库
git pull 别名 分支
克隆远程仓库
git clone 地址