在 GIT 中中止合并后丢失的本地更改
Local changes lost after aborting merge in GIT
我正在研究 visual studio 并正在使用 git。中止提交后,我丢失了所有本地更改。我做的步骤是:
- 使用 "Pull" 选项拉出分支,有一些冲突。
- 手动解决冲突并接受合并。
- 合并过程卡住了(我不知道为什么)。
- 已中止合并过程。此时我的所有本地更改都在待定更改选项卡中。
- 我关闭了 visual studio 并重新打开了解决方案,现在所有本地更改都丢失了。
有什么方法可以恢复我的更改。我用谷歌搜索但没有找到任何有用的东西。
这就是为什么在拉动之前,为了安全起见,我总是更喜欢进行提交。
站在同一边(除非你在Mac和Time Machine activated), you can install the plugin local-history:它会为你保存每个修改文件的状态。
关于git merge --abort
,man page does mention:
The second syntax ("git merge --abort
") can only be run after the merge has resulted in conflicts.
git merge --abort
will abort the merge process and try to reconstruct the pre-merge state.
However, if there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started), git merge --abort
will in some cases be unable to reconstruct the original (pre-merge) changes.
Therefore:
Warning: Running git merge
with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.
我正在研究 visual studio 并正在使用 git。中止提交后,我丢失了所有本地更改。我做的步骤是:
- 使用 "Pull" 选项拉出分支,有一些冲突。
- 手动解决冲突并接受合并。
- 合并过程卡住了(我不知道为什么)。
- 已中止合并过程。此时我的所有本地更改都在待定更改选项卡中。
- 我关闭了 visual studio 并重新打开了解决方案,现在所有本地更改都丢失了。
有什么方法可以恢复我的更改。我用谷歌搜索但没有找到任何有用的东西。
这就是为什么在拉动之前,为了安全起见,我总是更喜欢进行提交。
站在同一边(除非你在Mac和Time Machine activated), you can install the plugin local-history:它会为你保存每个修改文件的状态。
关于git merge --abort
,man page does mention:
The second syntax ("
git merge --abort
") can only be run after the merge has resulted in conflicts.
git merge --abort
will abort the merge process and try to reconstruct the pre-merge state.However, if there were uncommitted changes when the merge started (and especially if those changes were further modified after the merge was started),
git merge --abort
will in some cases be unable to reconstruct the original (pre-merge) changes.Therefore:
Warning: Running
git merge
with non-trivial uncommitted changes is discouraged: while possible, it may leave you in a state that is hard to back out of in the case of a conflict.