如何使用git恢复丢失的提交?

时间:2013-12-05 00:32:42

标签: git

我失去了重要的变化,不知道发生了什么事。

我对我要添加的文件git add。 然后我做了git commit -m

然后我做了另一个添加和提交。然后我将最新的数据移到master分支上,然后将分支与提交合并到我的主服务器中,并且更改已经消失。 “网格系统添加”是缺少的提交。我需要它。

我粘贴了下面发生的事情:

$ git status
# On branch mp_grid
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   Assets/MarkScratchPad.unity
#   modified:   Assets/Resources/GamePiece.prefab
#   modified:   Assets/Scripts/Grid/GridManager.cs
#   modified:   Assets/Scripts/Services/NotificationCenter.cs
#   modified:   ProjectSettings/EditorBuildSettings.asset

$ git add Assets/Scripts/Grid/Gridmanager.cs
$ git add assets/resources/gamepiece.prefab
$ git add assets/scripts/services/notificationcenter.cs
$ git add projectsettings/editorbuildsettings.asset
$ git add assets/markscratchpad.unity
$ git commit -m "Grid system additions"
# On branch mp_grid
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   Assets/MarkScratchPad.unity
#   modified:   Assets/Resources/GamePiece.prefab
#   modified:   Assets/Scripts/Grid/GridManager.cs
#   modified:   Assets/Scripts/Services/NotificationCenter.cs
#   modified:   ProjectSettings/EditorBuildSettings.asset
$ git add Assets/MarkScratchPad.unity
$ git commit -m "More updates"
[mp_grid bfd3bb3] More updates
$ git checkout master
$ git pull
$ git merge mp_grid

0 个答案:

没有答案