2

Working with branches and making merge I got errors

$ git merge FrontEndHtmlChecks
warning: Cannot merge binary files: docker/databases/ibdata1 (HEAD vs. FrontEndHtmlChecks)
warning: Cannot merge binary files: docker/databases/ib_logfile0 (HEAD vs. FrontEndHtmlChecks)

I had to exclude these binary files from git, so I tried to remove them from git but got errors :

$ git rm docker/databases/ibdata1
docker/databases/ibdata1: needs merge
rm 'docker/databases/ibdata1'
$ git rm docker/databases/ib_logfile0
docker/databases/ib_logfile0: needs merge
rm 'docker/databases/ib_logfile0'

so I can not make merge.

How to fix it ?

Modified Block # 2: I aborted the merge and deleted the files on master branch. I tried to merge again but got erroprs :

git merge FrontEndHtmlChecks
CONFLICT (modify/delete): docker/databases/ibdata1 deleted in HEAD and modified in FrontEndHtmlChecks. Version FrontEndHtmlChecks of docker/databases/ibdata1 left in tree.

Checking to FrontEndHtmlChecks I could not find how deleted these files as thery were commited and pushed before... How to do?

2
  • 3
    You should abort the merge, remove the files, clean up, then re-attempt the merge. Jan 4, 2019 at 13:43
  • Please, look at Modified Block # 2
    – mstdmstd
    Jan 4, 2019 at 14:59

2 Answers 2

2

If you've checked in the files already, adding them to the .gitignore won't work.

You may need to tell git to remove all cached files that used to be in source control, i.e.

git rm --cached docker/databases/ibdata1

see "git rm --cached x" vs "git reset head -- x"?

2

Either you can go with the options mentioned in Resolving a Git conflict with binary files

Or you can check .gitignore file. You can hide these files with the help of .gitignore.
You just need to mention the unwanted files under this file.

Example
.gitignore file (in the root path of your codebase)

docker/databases/* #This will ignore all files under docker/databases directory
*.iml #This will ignore IntelliJ (Idea) iml files.
*.log
.settings
.classpath
.project

Ref : https://git-scm.com/docs/gitignore

Not the answer you're looking for? Browse other questions tagged or ask your own question.