简体   繁体   English

如何恢复git意外拉动

[英]how to revert an git accidental pull

Before committing my local change I have accidentally took a pull from master on to my release feature branch. 在进行本地更改之前,我意外地从master转到了我的发布功能分支。 The pull have made many conflicts within my local workspace. 拉动在我的本地工作空间中造成了许多冲突。

Is there any way to revert the accidental master pull 有什么办法可以恢复偶然的主人拉

When I triggered 当我触发

git reflog --date=iso

c0ec509 HEAD@{2018-12-24 15:55:10 +0530}: clone: from https://bitbucket.com/scm/myproject.git

but the pull which I have done is at 2018-12-28 01:29 但是我所做的事情是在2018-12-28 01:29

Can anyone please tell me how to resolve this. 谁能告诉我如何解决这个问题。

git merge --abort to abort the merge. git merge --abort中止合并。

git reset --hard <commitId> to reset to a specific commit, you will lose anything . git reset --hard <commitId>重置为特定的提交, 您将丢失任何东西

git reset --soft <commitId> to reset to a specific commit, keeps uncommitted changes. git reset --soft <commitId>重置为特定的提交,保留未提交的更改。

To make sure you do not lose your local commit you can use git stash before doing anything and git stash pop when everything is fine. 为了确保您不会丢失本地提交,可以在执行任何操作之前使用git stash ,在一切正常时使用git stash pop

Try git reset --merge . 尝试git reset --merge This will abort the merge you have started. 这将终止您已开始的合并。

为了保留您未提交的更改,请尝试:

git reset --soft

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM