Gitアレコレ
リモートブランチをローカルにチェックアウトする
手順
- git fetch origin リモートブランチ名
- git checkout リモートブランチ名
例
$ git fetch origin 20180905_remote_branch From <Gitのリモートリポジトリ名> * branch 20180905_remote_branch -> FETCH_HEAD $ git checkout 20180905_remote_branch Branch '20180905_remote_branch' set up to track remote branch '20180905_remote_branch' from 'origin'. Switched to a new branch '20180905_remote_branch' $ git branch * 20180905_remote_branch master
git submodule
submodule側のブランチを切り替え、そのブランチを参照元のブランチで見るように切り替える
// 参照元 $ git stash modified: base/app/submodule $ cd base/app/submodule submoduleのブランチを切り替えて、参照元に戻る $ git stash modified: base/app/submodule (new commits) $ git add base/app/submodule $ git commit // 以降は通常のコミットのフローと同じ
git mergeに失敗
最新のmasterを現在の開発ブランチ(こちらも最新で全てのファイルがcommit済み)にmergeしようとしたら怒られた。
Please commit your changes or stash them before you merge. Aborting
とあるファイルがマージできないと言われていたのだが、git stashした後にgit mergeを試みたら上手く行った…