Local changes were not restore

下班的时候准备提交(git)代码走人 , 先更新到本地,然后再提交,这是平常一直使用的步骤。结果执行更新后,没有提示合并,把代码给我回退了到以前的版本了,在intellij 右下角提示了 Local changes were not restored

Local changes were not restored
Before update your uncommitted changes were saved to stash.
Update is not complete, you have unresolved merges in your working tree
Resolve conflicts, complete update and restore changes manually.
Local changes were not restore_第1张图片
image.png
  • 意思是:代码和服务器上的有冲突,合并失败了。未提交的更改被暂时保存到了stash (git的暂存区),要手动处理合并。

1 . 命令操作

# 查看存档列表,根据列表时间大概可以找出要恢复的东西
git stash list 
# 使用指定存档 , 存档编号就是上个命令中看到类似`stash@{0}`
git stash apply stash@{存档编号}
Local changes were not restore_第2张图片
image.png

2 . Intellij 操作

Local changes were not restore_第3张图片
image.png
Local changes were not restore_第4张图片
image.png

参考:

  • 解决使用android studio中的git update后报错当前未提交的代码被覆盖
  • Unstash Changes Dialog
  • Stashing and Unstashing Changes

你可能感兴趣的:(Local changes were not restore)