Help us understand the problem. What is going on with this article?

git pullで初めてのコンフリクト対応をした話 [error: Your local changes to the following files would be overwritten by merge:]

対応

エラーの発生

[root@www httpdocs]# git pull
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 12 (delta 8), reused 11 (delta 8), pack-reused 0
Unpacking objects: 100% (12/12), done.
From github.com:'リポジトリ名'
   e51a2493..2de855ba  master     -> origin/master
   2dbb9b53..17b9ca94  design     -> origin/design
error: Your local changes to the following files would be overwritten by merge:
    フォルダ名/ファイル名
Please commit your changes or stash them before you merge.
Aborting

git pullをした時にまさかのコンフリクト。
初めての共同開発の環境だったので、いつかは起こるだろうと思っていたけれども
まさか初日に起こるとわ・・・

ファイルの退避

$ git stash save conflict
aved working directory and index state On master: conflict
HEAD is now at d0ca05b9 Merge branch 'master' of github.com:'リポジトリ名'

conflictの所は自分がわかる様な名称を入れるとのことだったので、そのままコンフリクトと記入。(save 以降は省略できるみたいでgit stashでも良いとか・・・)

また、この退避って現状のファイルを退避させているのか、更新内容を退避させているのかどこにも書いてなかったので調べた・・・、結構な時間調べた。
けれども、帰りのバスの中で「普通に考えれば、現状のファイルを退避する訳ないなー。」と自己解決。

stashの確認

$ git stash list
stash@{0}: On master: conflict

待避出来たのかリスト表示させて確認、問題なくconflictがある。

$ git pull

一旦、git pullをして最新ソースを取得をして。

$ git stash pop

変更ファイルを復帰させて無事完了。

参考サイト様

@izcomaco様のとりあえずのGitメモ

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away