git中神秘消失的分支

git中神秘消失的分支,git,version-control,backup,branch,github,Git,Version Control,Backup,Branch,Github,下面是我执行的一些git操作。如您所见,我创建了一个新分支,修改了文件,然后提交了更改。在切换回另一个分支,希望合并之后,我正在处理的分支消失了 有人知道如何从fixed_merge_分支恢复文件吗?我吓坏了 1.9.2@whisperme$ git branch fixed_merge_conflict 1.9.2@whisperme$ git checkout fixed_merge_conflict M ArtworkViewController.h M ArtworkViewCo

下面是我执行的一些git操作。如您所见,我创建了一个新分支,修改了文件,然后提交了更改。在切换回另一个分支,希望合并之后,我正在处理的分支消失了

有人知道如何从fixed_merge_分支恢复文件吗?我吓坏了

1.9.2@whisperme$ git branch fixed_merge_conflict
1.9.2@whisperme$ 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'
1.9.2@whisperme$ git add .
1.9.2@whisperme$ cd Classes/
1.9.2@whisperme$ git add .
1.9.2@whisperme$ cd ..
1.9.2@whisperme$ git add -u
1.9.2@whisperme$ 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/
1.9.2@whisperme$ 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(-)
1.9.2@whisperme$ git checkout develop
Previous HEAD position was 858491f... re-did changes lost by merge screw up
Switched to branch 'develop'
1.9.2@whisperme$ git branch
  artwork_model
  artwork_model_localisation
  artwork_screen
* develop
  logger
  master
  start_artwork_model
1.9.2@whisperme$ git merge fixed_merge_conflict
fatal: 'fixed_merge_conflict' does not point to a commit
1.9.2@whisperme$ git checkout fixed_merge_conflict
error: pathspec 'fixed_merge_conflict' did not match any file(s) known to git.
1.9.2@whisperme$ git checkout fixed_merge_conflict
error: pathspec 'fixed_merge_conflict' did not match any file(s) known to git.
1.9.2@whisperme$ git branch
  artwork_model
  artwork_model_localisation
  artwork_screen
* develop
  logger
  master
  start_artwork_model
1.9.2@whisperme$ git checkout
1.9.2@whisperme$ git branch
  artwork_model
  artwork_model_localisation
  artwork_screen
* develop
  logger
  master
  start_artwork_model
1.9.2@whisperme$ pwd
/Users/tristan/Documents/DFR
1.9.2@whisperme$ 
1.9。2@whisperme$git分支已修复\u合并\u冲突
1.9.2@whisperme$git签出已修复\u合并\u冲突
M ArtworkViewController.h
M ArtworkViewController.M
M ArtworkViewController.xib
M类/DFRAppDelegate.h
M类/DFRAppDelegate.M
M类/WorkGalleryViewController.M
M类/WorkGalleryViewController.xib
M DFR.xcodeproj/project.pbxproj
M DFRViewController.xib
M Data.h
M Data.M
M main.xib
M cn.lproj/Localizable.strings
M en.lproj/Localizable.strings
A fr.lproj/Localizable.strings
切换到分支“修复\合并\冲突”
1.9.2@whisperme$git add。
1.9.2@whisperme$cd类/
1.9.2@whisperme$git add。
1.9.2@whisperme$cd。。
1.9.2@whisperme$git添加-u
1.9.2@whisperme$git状态
#目前不在任何分支上。
#要提交的更改:
#(使用“git重置磁头…”取消分级)
#
#修改:ArtworkViewController.h
#修改:ArtworkViewController.m
#修改:ArtworkViewController.xib
#修改:Classes/DFRAppDelegate.h
#修改:Classes/DFRAppDelegate.m
#修改:Classes/WorkGalleryViewController.m
#修改:DFR.xcodeproj/project.pbxproj
#修改:Data.h
#修改:Data.m
#修改:MainWindow.xib
#修改:cn.lproj/Localizable.strings
#修改:en.lproj/Localizable.strings
#
#未跟踪的文件:
#(使用“git add…”包含在将提交的内容中)
#
#阿尔普洛伊神父/
1.9.2@whisperme$git commit-m“重新执行因合并错误而丢失的更改”
[Distached HEAD 858491f]重新执行因合并错误而丢失的更改
12个文件已更改,110个插入(+),50个删除(-)
1.9.2@whisperme$git签出开发
以前的头部位置是858491f。。。重新执行因合并错误而丢失的更改
切换到“开发”分支
1.9.2@whisperme$git分行
艺术品模型
艺术品\模型\本地化
屏幕
*发展
记录器
主人
启动\u艺术品\u模型
1.9.2@whisperme$git合并已修复\u合并\u冲突
致命:“已修复\u合并\u冲突”未指向提交
1.9.2@whisperme$git签出已修复\u合并\u冲突
错误:pathspec“修复\u合并\u冲突”与git已知的任何文件都不匹配。
1.9.2@whisperme$git签出已修复\u合并\u冲突
错误:pathspec“修复\u合并\u冲突”与git已知的任何文件都不匹配。
1.9.2@whisperme$git分行
艺术品模型
艺术品\模型\本地化
屏幕
*发展
记录器
主人
启动\u艺术品\u模型
1.9.2@whisperme$git结帐
1.9.2@whisperme$git分行
艺术品模型
艺术品\模型\本地化
屏幕
*发展
记录器
主人
启动\u艺术品\u模型
1.9.2@whisperme$pwd
/用户/tristan/Documents/DFR
1.9.2@whisperme$ 

非常感谢

我不明白分支“消失”的确切原因,但别担心,你的文件没有

您可以通过多种方式找到它们:

  • 当您离开匿名分支机构时,您可以使用git checkout打印的消息:“以前的主管职位是858491f”
  • 您可以使用
    git reflog
    查找文件的提交
然后,您可以运行此命令来重新创建分支:

git checkout 858491f -b fixed_merge_conflict
git merge 858491f
然后您可以进行合并:

git checkout develop
git merge fixed_merge_conflict
或者,如果您不关心分支,也可以一步完成合并:

git checkout 858491f -b fixed_merge_conflict
git merge 858491f

出于某种原因,你会得到一份工作。我不完全确定这是如何在常规git回购中产生的,但我在使用
git svn
()时遇到过这种情况。这可能是因为当您创建新分支机构时,该分支机构没有跟踪上游回购。通常,当你得到一个
分离的头部
,当你做一个
git分支
,你会看到
(星号)(无分支)
(不知道如何做文字星号标记)

链接已损坏