Пусть это:Как восстановить комманду слияния после переустановки на тот же коммит?
mkdir test; cd test
echo "1" > file1; git init; git add .; git commit -m "initial - file 1" # 1st commit on master
echo "2" > file2; git add .; git commit -m "file 2" # 2nd commit on master
git checkout -b newbranch # creates newbranch
echo "1" >> file1; git add .; git commit -m "changed 1" # 1st commit on newbranch
git checkout master # goes to master
echo "2" >> file2; git add .; git commit -m "changed 2" # 3rd commit on master
git merge newbranch -m "merge commit" # merge newbranch on master
echo "3" > file3; git add .; git commit --amend -m "merge commit" # amend merge commit and adds file3
git rebase HEAD~2 # don't change anything, just leave
ls # there isn't file3 anymore!
Есть ли способ восстановить слияния коммит, чтобы изменения, которые были внесены поправки на него не теряются?
Thx, но любой из коммитов на 'git reflog' показывает' file3'. «Git whatchanged» на всех коммитах. – bitlogic
@bitlogic Еще раз проверьте. Запустив ваш скрипт, за которым следует 'checkout HEAD @ {4}', восстанавливается 'file3'. – Borealid
Да, это правильно. Это здесь. Странным является тот факт, что 'git whatchanged' не показывает добавляемый файл! – bitlogic