MeltingDog
MeltingDog

Reputation: 15404

Git: file on remote server is not being overwritten with updated version on merge

I must have accidentally pushed up a file where I did not remove the merge error markers (<<<<HEAD) and it broke my site.

I checked out the problem file, found the merge conflict and fixed the code. I then went to commit the file but get the message nothing to commit (working directory clean).

Regardless, I pushed the changes up to GitHub. In GitHub I can view the file and see that the code is correct. Great!

I then went to merge the fixed code into my remote site. But nothing happens. The merge performs fine, no errors, but the site still remained broken.

Curious, I checked out the same file. The bad code is still there, on the remote repo.

Would anyone know what's happening and how I could fix it? Here's the steps I took:

  1. git checkout develop file.etc
  2. fix code
  3. git status to confirm file is modified
  4. git add ., git commit and git push to Github
  5. Check on GitHub to see that file is modifed
  6. git merge branch-name
  7. Test to see if site is working

Upvotes: 1

Views: 26

Answers (1)

MeltingDog
MeltingDog

Reputation: 15404

OK, I think I understand what may have been going on here.

The remote repo is it's self a branch. I merged the bad file into that remote branch, but was 'checking it out' and trying to fix it on my original branch.

Since the file was fixed on my original branch, as visible up on GitHub, staging it wouldn't work - git didn't see any difference between the file I just fixed and the one already part of the branch, that's why it 'disappeared' when I added it and said there was nothing to commit.

As for why I couldn't merge in my branch in with the remote branch a 2nd time, I'm not sure.

Upvotes: 1

Related Questions