Announcement

Collapse
No announcement yet.

Resolving Conflicts That Are NOT Conflicts

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resolving Conflicts That Are NOT Conflicts

    This problem crops up occasionally and drives me crazy. I am unable to push my changes to the remote repository. I get conflict errors. The problem is that the "conflicts" are exactly the changes I made to the local source. They are not conflicts. Why does git think these are conflicts and how do I resolve this without duplicating all my changes on the remote source? TIA

  • #2
    What does your .git/config file have for remotes? Could you have 2 different types of line termination? (LF for Linux, CR/LF for Windows)?

    Comment


    • #3
      Thanks for the reply. There is only one remote which is Linux. I'm using Eclipse on Windows 7. I THINK this may be an issue with trying to amend a previous commit as this normally does not happen. I was working only in the local repository and committing changes by amending the same commit. Once I had my code as I wanted, I amended the current commit and tried to push it to the remote. That is when it failed.

      Now, I have a real mess on my hands that I need help to fix. I found an article that said to fix the problem to do a fetch and merge. I'm only working with the master branch (there are no other team members). Now my code contains lots of duplicate code from the remote repository and the current code. The first thing I need help with is how to get back to my pre-commit code. Once I get the working code back, then I can try to figure out how to push it.

      Comment


      • #4
        In general, it is ok to amend a commit up until you actually push it to the remote repo. After that you should not amend because it can break those who have already cloned or updated from the version you would write over.

        Since you state that there is no one else who is using this repo then the way around this is to enable non-fast-forward pushes in your remote (on the server).

        Try using the "-f" (force) option. You may need to enable non-fast-forward pushes by changing the configuration on the bare repo on the server by setting receive.denyNonFastForwards=false.

        Comment


        • #5
          Thanks again. That would solve the original problem but I need to undo the merge that messed everything up first. I should never had tried the fetch/merge suggestion. I would hate to have to manually sort through that mess manually.

          Comment


          • #6
            Just do a HARD reset back to the SHA before the merge commit. Cheers.

            Comment


            • #7
              Thanks. That went back a bit too far but I think that is the best that can be done. At least now the code I need to redo will be minimal.

              Comment

              Working...
              X