要移动已签出分支的分支指针,可以使用该git reset --hard命令.但是如何移动未检出分支的分支指针指向不同的提交(保留所有其他东西,如跟踪的远程分支)?
有没有办法识别特定提交的"附带"提交(编辑相同行并将导致冲突的提交)?
一个非常简单的例子
$ git init
$ echo test > test
$ git add test
$ git commit -m "First commit"
$ echo test1 > test
$ git commit -am "Second commit"
$ git l
* 95a29dd Second commit
* 30a68e6 First commit
$ type test
test1
Run Code Online (Sandbox Code Playgroud)
假设在这一点上无论出于何种原因我想要恢复30a68e6.
$ git revert 30a68e6
error: could not revert 30a68e6... First commit
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and …Run Code Online (Sandbox Code Playgroud)