0

I was able to "git add" my files, then "git commit". That went well. When I tried to push to the remote, I got error where Git was hinting to first "git pull" then try again. So I did a "git pull". But I ended up getting a bunch of CONFLICTs but only on some DLL files. I guess it's because we should be adding them to the .gitignore which we did not do yet.

How do I fix this current push?

Ray
  • 4,679
  • 10
  • 46
  • 92

3 Answers3

3

To solve the merge conflict you got, you have to choose between the local DLL file and the remote one:

git checkout --ours -- path/of/file.dll     # This chooses the local file
git checkout --theirs -- path/of/file.dll   # This chooses the remote file

Then you have to mark the conflict resolution with

git add path/of/file.dll

And finish the merge as usual (git commit once you're done)

If you want to ignore the DLL files (this is probably a good idea) you have to add them to the .gitignore file, but since their are already tracked by git, you have to undo this by

git rm --cached path/of/file.dll
Manuel Schmidt
  • 2,178
  • 2
  • 15
  • 19
0

git checkout accepts a --ours or --theirs option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging, you can do:

$ git checkout --theirs -- path/to/conflicted-file.txt

to use that version of the file. Likewise, if you know you want your version (not the one being merged in) you can use

$ git checkout --ours -- path/to/conflicted-file.txt

More answers here

Vikas
  • 6,868
  • 4
  • 27
  • 41
0

Merging binary files in git is not going to hold water. If the DLLs are generated from the code of the project:

1 - Binaries should not be part of what you keep on git.... but well, if you find it useful, make sure that DLLs are being generated for every new revision so that the DLLs match the source files of the revision (but that's another topic altogether).

2 - You should just generate the DLLs from the source code that was the result of the merge (having already solved all conflicts on the source files) and then commit it all.

eftshift0
  • 26,375
  • 3
  • 36
  • 60