0

When I merged with another branch, a few of my files became modified automatically.
I tried to checkout -- on the files, but git status still shows them as modified.

I then tried a custom shell function that normally fixes these kinds of problems for me:

cd `git rev-parse --show-toplevel`;
git reset --hard HEAD && git clean -d -f;
cd -; 
git rm -r --cached .
git reset --hard HEAD

The files still showed up as modified.

I tried running these chunks of commands through different versions of:

git config --global core.autocrlf true
git config --global core.autocrlf false
git config --global core.autocrlf input

The files still show as modified.
I just want a clean git status...

Is there a command that is guaranteed to do this?

Trevor Hickey
  • 36,288
  • 32
  • 162
  • 271
  • What is your OS? I had similar issues on Windows several years ago. I fixed it by setting `core.filemode` to `false`. – Paul Dec 16 '16 at 20:17
  • @Paul I'm on linux, but it's possible the files merged came from windows. I've tried setting `core.filemode`, and re-running my commands. They are still modified. – Trevor Hickey Dec 16 '16 at 20:19
  • If you `git diff` your "modified" files what will you get? – Paul Dec 16 '16 at 20:21
  • Every line has changed, but they look exactly the same. I assume its line ending related!? – Trevor Hickey Dec 16 '16 at 21:57
  • Check for line-end adjustment in `.gitattributes` (via `eol=` conversions), or smudge and clean filters. See http://stackoverflow.com/questions/5009096/files-showing-as-modified-directly-after-git-clone and http://stackoverflow.com/questions/39076854/why-does-git-keep-messing-with-my-line-endings – torek Dec 16 '16 at 22:22

0 Answers0