git一些笔记
2018-10-09 本文已影响0人
相信灬你一直在
连接码云

工作区到栈到git库

git init //创建成git管理仓库
git add . // 添加文件到栈里
git commit -m "添加你想写的信息" //上传到git库里
git status //查看状态
git log //查看上传到历史
git reset HEAD~ //还原到上一个版本,波浪线表示上几个版本
git checkout -- 文件名 // 恢复文件
git rm -f 文件名 //强制删除暂存区的和工作区的文件
git rm --cached 文件名 //删除暂存区文件,保留工作区的文件
git branch 名字//创建分支
git checkout 名字 //切换分支
git merge 分支名 //合并分支
git checkout -b 分支名字 //创建并且跳转到分支上
git branch -b 分支名字 //删除分支
下面是reset 不是rest




提交后,用git diff HEAD -- readme.txt命令可以查看工作区和版本库里面最新版本的区别:
git checkout -- file命令中的--很重要,没有--,就变成了“切换到另一个分支”的命令,我们在后面的分支管理中会再次遇到git checkout命令。

reset 和checkout的区别
