Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个功能分支。我犯了一些本应该在主人身上的事情。我检查了 master 并精心挑选了这个提交,然后推送。回到特性分支,如果我对 master 进行 rebase,我会丢失特性分支上的所有提交。如何从中恢复?
您可以通过使用查看分支指向的最后一次提交git reflog feature_branch_name。然后,您可以git reset --hard <SHA>在您的功能分支上将其重置为此提交。
git reflog feature_branch_name
git reset --hard <SHA>