【发布时间】:2011-04-21 07:53:41
【问题描述】:
我在这件事上搞砸了。 我正在处理一个分支“feature1-branch”并提交了更改,但没有将它们与 master 合并。
git 日志显示如下内容:
git log
commit 0829f9f0b68ce58ca37efd4e07cf3e8b3b67ed49
Date: Thu Apr 21 00:38:58 2011 -0700
feature1-branch lots and lots of changes
我不确定我在想什么,但我确实做到了:
git checkout master
这删除了一堆使用分支“feature1-branch”添加的新文件。
现在 git 状态显示:
git status
# On branch feature1-branch
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: app/controllers/activations_controller.rb
# deleted: app/controllers/settings_controller.rb
# modified: app/controllers/application_controller.rb
# deleted: app/controllers/products_controller.rb
提到的已删除文件不再存在。 我如何让他们回到我提交时的状态
0829f9f0b68ce58ca37efd4e07cf3e8b3b67ed49
我担心这些文件是否永远消失了。
感谢您的帮助。
添加附加信息:
git log -1 feature1-branch
commit 0829f9f0b68ce58ca37efd4e07cf3e8b3b67ed49
Date: Thu Apr 21 00:38:58 2011 -0700
feature1-branch lots and lots of changes
这是 git checkout 返回的内容:
git checkout feature1-branch
D app/controllers/activations_controller.rb
D app/controllers/products_controller.rb
M app/controllers/application_controller.rb
git 状态返回:
git status
# On branch feature1-branch
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# # deleted: app/controllers/activations_controller.rb
# deleted: app/controllers/products_controller.rb
no changes added to commit (use "git add" and/or "git commit -a")
【问题讨论】:
标签: git git-branch