26
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

git pull時に 【Your local changes to the following files would be overwritten by merge】とエラー

Last updated at Posted at 2020-03-23

#エラー内容

$ git pull origin masterをすると

error: Your local changes to the following files would be overwritten by merge:
	config/routes.rb
Please commit your changes or stash them before you merge.

が出てくる。

#原因
pullした内容と自分の編集した箇所(ここではconfig/routes.rb)が被っている。

#解決策
pullした内容の箇所が自分も編集している所の為、
mergeする前にcommitするかstashしてと言われる。

なので、今回はコミットを選択。

$ git add * 
$ git commit -m "コミット名" 
$ git push origin 自分の作業ブランチ 

でpushし、Github上で
コンフリクトが起きなければ再度、

$ git pull origin master 

とpullすればOK。
コンフリクトの場合はコンフリクト内容を修正してから再度、pull。

26
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?