views:

93

answers:

1

I'm a happy user of PortableGit 1.7.0.2. Today I wanted to pull a project changes from GitHub.com repository, so I did git pull. It failed with the following message: error: Your local changes to 'main.rb' would be overwritten by merge. Aborting.. I didn't care about the local changes so I typed git reset --hard HEAD (git clean from here didn't help neither), but it didn't work. When asked for git status I was still able to see the file as modified. git diff showed me that each line of the file has been modified, while git diff -b showed no differences at all, so I guess this is a line ending issue. Which is strange because the code is only pushed from Windows machines.

Anyway, the question is: how can I ignore the local, bogus changes and merge with the latest changes from the remote repository?

+1  A: 

First, did you try a git clean -f (note the '-f')?
From git config man page:

clean.requireForce

A boolean to make git-clean do nothing unless given -f or -n. Defaults to true.

Second, did you set your autocrlf setting to false as I mention in this question?
(even if pushed from a Windows machine to a Windows PC, a text file with Unix eol would be converted to Windows eol)

With those two points taken care of, you should be able to pull.

VonC
I did use the '-f', but haven't heard about 'autocrlf' before. The later did help, thanks VonC!
zaza