カレントブランチに未コミットな差分があると、他のブランチをチェックアウトできません。そこでいったん git stash
やってからチェックアウトして git pull
しますが、これ面倒ですよね。
というわけで git fetch
で、カレントでないローカルブランチに直接リモートのコミットを落としてきます。
git fetch -u origin master:master
-u, --update-head-ok
By default git fetch refuses to update the head which corresponds
to the current branch. This flag disables the check. This is purely
for the internal use for git pull to communicate with git fetch,
and unless you are implementing your own Porcelain you are not
supposed to use it.
リモートのブランチが多いのでそれ GUI で一覧から選んで指定するの大変で、ってときに都合いいですね。
また、カレントブランチはクリーンな状態でも、リベースの時とかいちいち切り替えて戻ってやってワーキングのファイルをごちゃごちゃ書き換えするよりは、こうやって...
git fetch -u origin master:master
git rebase -i master