1. 配置提交人姓名: git config --global user.name
2. 配置提交人邮箱: git config --global user.email
3. 查看git config --list 查看配置信息
4. git init 初始化仓库
5. gut status 查看文件状态
6. git add 文件列表 追踪文件
7 git commit -m 提交信息 向仓库中提交代码
8 git log 查看提交日志
9 git reset --hard commitID 恢复到指定版本
撤销
- 用暂存区中的文件覆盖工作目录中的文件:
git checkout 文件
- 将文件从暂存区中删除:
git rm --cached 文件
- 将 git 仓库中指定的更新记录恢复出来,并且覆盖暂存区和工作目录:
git rest --hard commitID
提交多个文件
git add --all
git commit -m ‘add more files’
git push origin master
添加远程仓库
- 使用别名 orgin 代替仓库地址
git remote add orgin 地址
// 用别名代替推送地址
git push -u orgin master - 或者
git push 仓库地址 master - 记住提交
git push -u 仓库地址 master 第一次输入密码
git push 第二次直接可以直接push