0

There are files in local project, I want to keep untouched - some configs with directives neccessary only for local development. I also do not want them to go to remote origin as it will break the app.

I've put corresponding entries to .gitignore, which I also do not want either to share nor accept changes into it. I even did git update-index --assume-unchanged, so changes in mentioned files not tracked and not shown on "git status". But when "pulling" from remote origin (or explicitly make merge after fetch) I get

error: Your local changes to the following files would be overwritten by merge:     
    .gitignore  
    app/core/config.js

Please, commit your changes or stash them before you can merge.
Aborting

Due to the fact my staging area is empty there is nothing to commit or stash. Which is proper set up for the case when I have files not to be merged?

kowsky
  • 12,647
  • 2
  • 28
  • 41

1 Answers1

0

The problem is your local .gitignore file: you have a local one, but there is also one in the remote repository. Upon merging, your local .gitignore would be overwritten. Since there exists a .gitignore file, you should just add the contents of your local .gitignore to the one in the remote repository.

Also, since app/core/config.js is also mentioned here, I suspect that it's not listed in your .gitignore although it should be.

kowsky
  • 12,647
  • 2
  • 28
  • 41
  • Yes both .gitignore and app/core/config.js entries are already in .gitignore. – Sergey Cherednichenko Oct 05 '17 at 07:46
  • But as I`ve already realized .gitignore has no power after cloning, so maybe there is a possibility to create it before cloning. Need to try it before making conclusion. Besides I wouldn`t change remote .gitignore file. – Sergey Cherednichenko Oct 05 '17 at 07:56
  • You should take a look at [this answer](https://stackoverflow.com/a/767213/7598462) that suggest the use of `.git/info/exclude` to ignore files locally. The `.gitignore` file is intended to be shared across the repository. – kowsky Oct 05 '17 at 10:55