私は 'my_local_branch
' という名前のローカルブランチを持っており、それは origin/my_remote_branch
というリモートブランチを追跡しています。
今、リモートブランチは更新され、私は 'my_local_branch
' にいて、その変更を取り込みたいのです。そうすればいいのでしょうか?
git pull origin my_remote_branch:my_local_branch
これは正しい方法なのでしょうか?
そのブランチの上流に設定されている
(をご覧ください):
--set-upstream-to
をいつもする必要があるのですか";
)<pre>; git branch -f --track my_local_branch origin/my_remote_branch
git branch --set-upstream-to my_local_branch origin/my_remote_branch です。 </pre>;
(git branch -f --track
は、ブランチがチェックアウトされている場合は動作しません。代わりに 2 番目のコマンド git branch --set-upstream
を使用すると、 "fatal: Cannot force update the current branch.
")
つまり、あなたのブランチは、すでに設定されているということです:
branch.my_local_branch.remote origin
branch.my_local_branch.merge my_remote_branch
Gitはすでに必要な情報を持っています。
その場合は
# if you weren't already on my_local_branch branch:
git checkout my_local_branch
# then:
git pull
があれば十分です。
もしあなたが 'my_local_branch
' をプッシュするときに上流ブランチの関係を確立していなかったら、単純に git push -u origin my_local_branch:my_remote_branch
で十分プッシュでき、上流ブランチを設定できたはずでした。
その後のpull/pushは、やはりgit pull
またはgit push
で十分でした。