【git】在分支中执行add,commit之后,代码丢失

来源:互联网 发布:淘宝店铺如何添加客服 编辑:程序博客网 时间:2024/05/29 15:14

  使用git来管理自己的代码,在分支中执行命令add 和 commit之后,使用git push推送到了远程仓库,但是从远程仓库看的时候,并没有发现更新的代码。切换到主分支重新执行了add,commit,push 3个命令,也远程仓库也没有变化。晚上太晚了,就没有再解决。

  第二天发现所有的代码丢失了。在master分之下,无法切换到Taotao-A 分支。

问题

fxq@DESKTOP-ASCGQPD MINGW64 /g/Java/Taotao (master)$ git checkout Taotao-Afatal: Unable to create 'G:/Java/Taotao/.git/index.lock': File exists.Another git process seems to be running in this repository, e.g.an editor opened by 'git commit'. Please make sure all processesare terminated then try again. If it still fails, a git processmay have crashed in this repository earlier:remove the file manually to continue.

  重新创建新的分支,同样出现上述问题,无法切换分支;


解决方案

rm -f ./.git/index.lock 

 

  切换成功,进入Taotao-A 分支,之后代码就恢复了。再见

0 0
原创粉丝点击