0

I removed the execute bit from *.h and *.cpp files. I committed the changed and tried to push them. The machine I was working on does not have my SSH keys, so the push failed.

I did the same on a different machine with the SSH keys, and I was able to commit and push the changes. I needed to use Updating file permissions only in git however, because Git did not observe or recognize the changed file permissions.

Now, I'm back on the original machine. I performed a git pull, but its refusing to take the changes:

$ git pull
remote: Counting objects: 2, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 2 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (2/2), done.
From https://github.com/weidai11/cryptopp
   4206b4a..f03ab5c  master     -> origin/master
Updating 4206b4a..f03ab5c
error: Your local changes to the following files would be overwritten by merge:
    cpu.cpp
    cpu.h
    cryptlib_bds.cpp
    emsa2.cpp
    emsa2.h
    salsa.cpp
    salsa.h
    serpentp.h
    sosemanuk.cpp
    sosemanuk.h
    vmac.cpp
    vmac.h
Please, commit your changes or stash them before you can merge.
Aborting

Apparently, git is too dumb to realize that the file permission is 0644 locally and 0644 remotely, so there is nothing to do.

How do I tell git there is nothing to merge?

Community
  • 1
  • 1
jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

0

If you really think there are no changes on your local box you want to preserve, a git checkout . will undo your local "changes," and you can then pull. Or, if git thinks your changes have been added to the index, a git reset --hard HEAD will blow everything away. I would play it safe, though, and do a git stash instead. This way any changes you didn't realize you had will at least be accessible.

David Deutsch
  • 17,443
  • 4
  • 47
  • 54
  • Yes, I had to `git update-index --chmod=-x *.h *.cpp`. I want to avoid the `git reset --hard HEAD` because I am working on a patch, so other files have changed. Is it not possible to tell Git to take the remote changes because there are no differences in what its complaining about? – jww Jun 24 '15 at 18:33