1:拉去或者更新代码
都需要pull代码或者同步后,才可以看到最新的日记记录
git pull(获取) = git fetch(拉取) + git merge(合并)
git pull
2:git add (暂存区)添加了多余的文件可以回退add之前
//第一种方法
git reset head
//第二种方法 git reset demo.txt
git reset 文件名
//第三种方法 git rm --cached demo.txt
git rm --cached 文件名
3:回退commit(本地版本库)状态没有push的文件
/两个--前后都有空格
git checkout -- filename
4:回退commit和add状态没有push的文件
git reset --hard
//相当于与运行了两条指令:
git reset *
git checkout -- *
5:回退某个人指定版本,不影响最新的版本
// git bash here 命令操作时候,进入了vim,按:q退出
git revert commitid
//反做后需要add,commit,push,重新对该版本提交
6:如果使用的是git reset --hard commitid回退版本的话
git reset --hard commitid //工作区,暂存区(索引add),本地仓库(commit),重置
git reset --mixed commitid //工作区不变,本地仓库(commit)和暂存区(索引add)重置
git reset --soft commitid //工作区不变和暂存区(索引add)不变,重置本地仓库(commit)
//如上操作都会进行版本回退,日记记录也会回退,别人更新后,还需要回退版本才行
都需要pull代码或者同步后,才可以看到最新的日记记录
git pull(获取) = git fetch(拉取) + git merge(合并)