下班的时候准备提交(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.
- 意思是:代码和服务器上的有冲突,合并失败了。未提交的更改被暂时保存到了stash (git的暂存区),要手动处理合并。
1 . 命令操作
# 查看存档列表,根据列表时间大概可以找出要恢复的东西
git stash list
# 使用指定存档 , 存档编号就是上个命令中看到类似`stash@{0}`
git stash apply stash@{存档编号}