Git Cheatsheet Part 4: Change, Restore and Reset
Table of Contents
撤销和恢复
移动一个文件到新的为位置 1
git mv <file> <new-file>
1
git rm <file>
1
git rm --cached <file>
1
git checkout <file> <commit-id>
1
git revert <commit-id>
--hard
参数表示重置工作区和暂存区,--soft
参数表示重置暂存区,--mixed
参数表示重置工作区
1
git reset --mixed <commit-id>
1
git restore --staged <file>
修改信息查看
列出还未提交的新的或修改的文件 1
git status
--oneline
可以忽略 1
git log --oneline
1
git diff
1
git diff <commit-id> <commit-id>
Git Cheatsheet Part 4: Change, Restore and Reset