GuilleDelicia
GuilleDelicia

Reputation: 49

Ignored files in Git would be overwritten by merge

When I do pull in my server, this is the message I get:

error: Your local changes to the following files would be overwritten by merge: css/custom.css images/logo.png Please, commit your changes or stash them before you can merge.

But those 2 files are ignored in my .gitignore like this:

# general
inc/config.php
css/custom.css
favicon.ico

What I am doing wrong? Thanks in advance!

Upvotes: 0

Views: 1856

Answers (1)

MiharbKH
MiharbKH

Reputation: 206

1) Some team member has already committed those file so when you make a git pull you will recover those committed files changes and in your next commit those files will be considered as ignored file.

2) Before merging you need to:

  • commit your modifications: git add path/to/modified-file then git commit -m "commit message" and finally git pull

Or

  • Stash your modifications: git stash then git pull And to recover your modifications again use git stash pop

Upvotes: 1

Related Questions