私がまだ混乱している Git の 1 つの状況は次のとおりです。
$ git clone https://github.com/dude1/project
おっと、それは実際には正しいバージョンではありません。切り替えます:
$ git remote add dude2 https://github.com/dude2/project
$ git fetch dude2
$ git checkout dude2/master
Note: checking out 'dude2/master'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at f3o845a...
うーん。master
dude2/master を参照したい。
$ git checkout -b master dude2/master
fatal: A branch named 'master' already exists.
ディレクトリ全体を削除してやり直す以外に、リポジトリをきれいに切り替えるにはどうすればよいですか?