赞
踩
stash 之后的内容没有应用到代码上就直接给删除了。如何恢复代码?
首先,执行:
git fsck --lost-found
执行完之后会得到很多 id ,其中会标明哪个是 commit
Checking object directories: 100% (256/256), done. Checking objects: 100% (64354/64354), done. dangling blob eb0a5cabe0d2030d22c011ffd96584a8b9d46ef5 dangling blob f70d5ccb0439260ea17892401cb22e54f456bf04 dangling blob 5e13c8974187cdf3d3bd171c38bcb7ed88ce9672 dangling blob a1140825d9cd0ebd157098b8d4f8685383d66a59 dangling blob 841a404f69eba49fb48b5d5ef1864681b9221ca4 dangling blob 36222c728e3596e57e7837bb46361b436ef7dd90 dangling blob 492320b8281788ea90a4154b92e1adeb8cba9fbd dangling blob 81279c8f3fd9b95edae9bfb16c2655236880d679 dangling blob 0b2e7c8280893cd0f461d59b4e2787fca00215fa dangling blob 2c32a4721204375f08699df533e25df087ba5614 dangling blob f934a008b42005ff416099ddf4619b25f3019195 dangling blob c938a8d3a8de7b2b91cebff691a0c7b07c83e1d3 dangling tree b43eb805a4f9e525118c10f3c8dc58ddf35be8db dangling blob ff3ec88e19a4a202d1f8d4e987e2052375500ad7 dangling blob c03f7c6eea43833c92a27f605ce564f90fe6c491 dangling commit a3aed9355e4efbf5a149a8e53a672c47625d1932 dangling blob 4e410cea8127c6b84b58e4f67bcc3a9b3f410f74
可以通过 git show 来查看是否是自己想要的代码,排列顺序是最新的在最上面。
git show + id
找到想要的代码 id 后,执行 git merge 来恢复代码
git merge + id
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。