1.查看本地文件的状态:git status
2.查看本地文件的变化:git diff
3.将文件添加到暂存区:git add 文件名(或 git add .)
4.将文件从暂存区删除:git rm 文件名
5.将文件提交到本地工作区:git commit
6.将文件提交到远程库: git push . (或 repo upload .)
7.查看提交log:git log
8. 回滚到历史版本:git reset [--hard] 版本号
9.删除untracked文件:git clean -df
10.当使用git pull拉代码,文件产生冲突时:
可以先保存当前修改(前提在git commit之后):
git format-patch HEAD~1 -o 保存目录
git pull 拉到最新代码
git am 保存目录中的patch文件