简体   繁体   English

从本地删除分支后如何恢复本地提交的更改(但不推送到远程)?

[英]How to recover locally committed changes(but not pushed to remote) after deleting branch from locally?

I have done few changed in my branch which i committed locally but not pushed to remote..but mistakenly i removed that branch from local and then again fetch that branch from remote.我在本地提交但未推送到远程的分支中几乎没有做任何更改..但是我错误地从本地删除了该分支然后再次从远程获取该分支。

In this scenario how can i get changes which i committed locally?在这种情况下,我如何才能获得我在本地提交的更改?

Thank you for help谢谢你的帮助

Do a git reflog --no-abbrev .做一个git reflog --no-abbrev

Identify the last commit of of the deleted branch.标识已删除分支的最后一次提交。

Do git checkout -b <your-branch-name> <commit-hash>执行git checkout -b <your-branch-name> <commit-hash>

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

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