创建本地仓库

git init · 将所在目录设置为git仓库

git init -bare <文件名> 新建一个裸仓库

拷贝远程仓库到本地

git clone <链接> 拷贝仓库

添加文件到版本库

git add . 添加所有文件

git add <文件名> 添加指定文件

撤销文件添加

git reset HEAD . 撤销所有文件添加

git reset HEAD <文件名> 撤销添加指定文件

git reset -mixed 文件退出暂存区,但修改保留

文件提交到仓库

git commit -m “提交的注释”

查看提交

git status

远程仓库管理

git remote add <版本库名> <链接> 添加远程版本库

git remote remove <版本库名> 删除远程版本库

推送到远程主机

git push <版本库名> <远程分支名>