以下是我執行的一些git動作。正如你所看到的,我做了一個新的分支,修改了我的文件,然後提交了更改。在換回另一個分支後,希望合併後,我剛剛開始工作的分支消失了。git中的神祕消失分支
有誰知道我可以從fixed_merge_branch恢復文件嗎?我嚇壞了!
[email protected]$ git branch fixed_merge_conflict
[email protected]$ git checkout fixed_merge_conflict
M ArtworkViewController.h
M ArtworkViewController.m
M ArtworkViewController.xib
M Classes/DFRAppDelegate.h
M Classes/DFRAppDelegate.m
M Classes/WorkGalleryViewController.m
M Classes/WorkGalleryViewController.xib
M DFR.xcodeproj/project.pbxproj
M DFRViewController.xib
M Data.h
M Data.m
M MainWindow.xib
M cn.lproj/Localizable.strings
M en.lproj/Localizable.strings
A fr.lproj/Localizable.strings
Switched to branch 'fixed_merge_conflict'
[email protected]$ git add .
[email protected]$ cd Classes/
[email protected]$ git add .
[email protected]$ cd ..
[email protected]$ git add -u
[email protected]$ git status
# Not currently on any branch.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: ArtworkViewController.h
# modified: ArtworkViewController.m
# modified: ArtworkViewController.xib
# modified: Classes/DFRAppDelegate.h
# modified: Classes/DFRAppDelegate.m
# modified: Classes/WorkGalleryViewController.m
# modified: DFR.xcodeproj/project.pbxproj
# modified: Data.h
# modified: Data.m
# modified: MainWindow.xib
# modified: cn.lproj/Localizable.strings
# modified: en.lproj/Localizable.strings
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# fr.lproj/
[email protected]$ git commit -m "re-did changes lost by merge screw up"
[detached HEAD 858491f] re-did changes lost by merge screw up
12 files changed, 110 insertions(+), 50 deletions(-)
[email protected]$ git checkout develop
Previous HEAD position was 858491f... re-did changes lost by merge screw up
Switched to branch 'develop'
[email protected]$ git branch
artwork_model
artwork_model_localisation
artwork_screen
* develop
logger
master
start_artwork_model
[email protected]$ git merge fixed_merge_conflict
fatal: 'fixed_merge_conflict' does not point to a commit
[email protected]$ git checkout fixed_merge_conflict
error: pathspec 'fixed_merge_conflict' did not match any file(s) known to git.
[email protected]$ git checkout fixed_merge_conflict
error: pathspec 'fixed_merge_conflict' did not match any file(s) known to git.
[email protected]$ git branch
artwork_model
artwork_model_localisation
artwork_screen
* develop
logger
master
start_artwork_model
[email protected]$ git checkout
[email protected]$ git branch
artwork_model
artwork_model_localisation
artwork_screen
* develop
logger
master
start_artwork_model
[email protected]$ pwd
/Users/tristan/Documents/DFR
[email protected]$
非常感謝!
非常感謝!那正是我需要的。 – WoodenKitty 2011-01-20 05:58:18