Created
February 15, 2017 04:26
-
-
Save kitakado-h/11d012cbe72702272fb4e96b074722c3 to your computer and use it in GitHub Desktop.
gitフォルダがなくなってしまった場合の復帰の忘備録
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
とにかく | |
git init | |
続いて | |
git remote add origin https://●●●●@bitbucket.org/●●●●.git | |
で、 | |
•まずはfetch実行 | |
git fetch origin | |
※originがリモートブランチの場合 | |
•fetchしたブランチにリセット(–hardで作業ディレクトリ、ステージングディレクトリ) | |
git reset --hard FETCH_HEAD | |
”FETCH_HEAD” で最後にfetchしたブランチの先頭の意(git fetch. で入手したコミットの先頭) | |
この状態でpullまたはmergeしたかった状態に作業ディレクトリ、ステージングディレクトリともになる |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment