We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
分支游标 master探秘
Git提供了 git reset命令,可以将“游标”指向任意一个存在的提交ID。
git reset
git reset --hard HEAD^
The text was updated successfully, but these errors were encountered:
用 reflog挽救错误的重置
reflog
git reflog show master | head -5
重置master 为两次改变之前的值
master
git reset --hard master@{2}
Sorry, something went wrong.
深入了解 git reset命令
用法一:git reset [-q] [<commit>] [--] <paths> ...
git reset [-q] [<commit>] [--] <paths> ...
第一种用法(包含了路径<paths>的用法)不会重置引用,更不会改变工作区,而是用指定提交状态(<commit>)下的文件(<paths>)替换掉暂存区中的文件。例如命令 git reset HEAD <paths>相当于取消之前执行的 git add <paths>命令时改变的暂存区。
<paths>
<commit>
git reset HEAD <paths>
git add <paths>
用法二:git reset [--soft | --mixed | --hard | --merge | --keep] [-q] [< commit>]
git reset [--soft | --mixed | --hard | --merge | --keep] [-q] [< commit>]
第二种用法(不使用路径<paths>的用法)则会重置引用。根据不同的选项,可以对暂存区或工作区进行重置。
命令:git reset --hard HEAD 彻底撤销最近的提交。引用回退到前一次,而且工作区和暂存区都会回退到上一次提交的状态。自上一次以来的提交全部丢失。
git reset --hard HEAD
No branches or pull requests
分支游标 master探秘
Git提供了
git reset
命令,可以将“游标”指向任意一个存在的提交ID。The text was updated successfully, but these errors were encountered: