#author("2018-09-13T19:13:45+09:00","default:Miyashita","Miyashita") #author("2018-09-13T19:14:15+09:00","default:Miyashita","Miyashita") *git pull や git merge を忘れたとき [#h2c60ee7] 例えば,ローカルの master が origin/master より数コミット遅れているのにも関わらず,ローカルで変更をしてしまったとき.~ ローカルの master でのコミットはまだ行っていないものとする.~ +git stash で現在のローカルの情報を保存 #codeprettify{{ git stash }} ~ +mergeまたはpull #codeprettify{{ git fetch origin #既に最新情報の場合 fetch は不要 git merge origin/master }} または #codeprettify{{ git pull origin master }} ~ +showでstashとの差分を確認する +showでstashとの差分を確認する~ showでstashした時と最新のorigin/masterを反映させた現在の状態との差分を確認する. #codeprettify{{ git show -p }} ~ +stash pop(stash apply)でstashを現在のmasterに適用する #codeprettify{{ git stash pop }} または #codeprettify{{ git stash apply [index] }} git stash applyのインデックスはgit logで確認する.~ ~ +競合の問題などを解決後, add, commit #codeprettify{{ git add . git commit -m "commit massage" }} ~ +競合後修正してstashが削除されていない場合はstashを削除 #codeprettify{{ git stash drop }}