Я очень плохо запутался в этом.
Я работал над веткой 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")