# test-git **Repository Path**: keelau/test-git ## Basic Information - **Project Name**: test-git - **Description**: No description available - **Primary Language**: NodeJS - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-30 - **Last Updated**: 2024-04-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 回退修改 ### 用暂存区内容覆盖工作区内容 ``` git restore .\README.md ``` ### 用上一次提交覆盖暂时区 ```git git reset HEAD ``` ### 取消提交commit,commit内容回退到工作区中 即会修改工作区内容 ``` git reset HEAD^ ``` #### 取消提交commit,commit内容回退到暂存区 不会修改工作区内容,修改暂时区内容 ``` git reset --soft HEAD^ ``` ### 取消提交commit,工作区,暂存区内容,都会被覆盖 ``` git reset --hard HEAD^ ``` ### 取消暂存区内容 ``` git restore --stage .\README.md ``` ## 修改对比 ### 比较工作区和暂存区之间的差异 ``` git diff git diff / git diff / -- ``` ### 比较暂存区和最后一次 commit 之间的差异 ``` git diff --staged git diff / --staged ``` ### 比较工作区和最后一次 commit 之间的差异 ``` git diff HEAD git diff origin/main HEAD -- ```