0

I ran in to this particular situation

I did a git clone on a new folder on my local for the master branch , when I do git status it shows

 modified:   sites/all/themes/DIR/css/style.css
#   modified:   sites/all/themes/DIR/css/style1.css
#   modified:   sites/all/themes/DIR/css/style2.css
#   modified:   sites/all/themes/DIR/css/style3.css
#   modified:   sites/all/themes/DIR/css/styleResponsive.css
#   modified:   sites/all/themes/DIR/favicon.ico
#   modified:   sites/all/themes/DIR/greysliver.png
#   modified:   sites/all/themes/DIR/less/bootstrap.less
#   modified:   sites/all/themes/DIR/less/content.less
#   modified:   sites/all/themes/DIR/less/footer.less
#   modified:   sites/all/themes/DIR/less/header.less
#   modified:   sites/all/themes/DIR/less/overrides.less
#   modified:   sites/all/themes/DIR/less/style.less
#   modified:   sites/all/themes/DIR/less/variables.less
#   modified:   sites/all/themes/DIR/logo.png
#   modified:   sites/all/themes/DIR/screenshot.png
#   modified:   sites/all/themes/DIR/template.php
#   modified:   sites/all/themes/DIR/templates/page.tpl.php

I am confused with this behavior, how can a fresh git clone bring unstaged changes with it.

Some background:

I had actually copied

sites/all/themes/DIR

as

sites/all/themes/dir

so now when I try to remove the shown status DIR files, it starts showing me sites/all/themes/dir files in the modified status even though I do not remove that directory.

I tried doing a checkout on these files as well as git reset . and git clean -f , this did not change anything Also the git stash way did not work. I am unsure why a clean checkout might be doing this except that it keeps referring to another folder where the original repo was on my local.

How to fix this scenario and not have any unstaged files on a fresh checkout.

This is on Mac OSX 10.9.4, files were committed from ubuntu and are hosted on ubutu.

git ls-tree master^{tree} sites/all/themes/

shows

040000 tree 7de9d4fc327d8e3087dc566d2a4b1602d45114e1 sites/all/themes/DIR 040000 tree b5b51e2e760ef42632270bc19554f5164c151718 sites/all/themes/dir

Zoe
  • 27,060
  • 21
  • 118
  • 148
pal4life
  • 3,210
  • 5
  • 36
  • 57
  • 2
    Maybe problem with letter-case, see http://stackoverflow.com/a/5022417/356838 – pmod Jul 29 '14 at 22:05
  • Check the line endings in the repo and have a look at https://help.github.com/articles/dealing-with-line-endings to see which settings are appropriate for your case. When I last ran into this behavior it was due to some Window's style line endings in the repo – Angelo Genovese Jul 29 '14 at 22:06
  • @AngeloGenovese I also though of this, but png? – pmod Jul 29 '14 at 22:07
  • Sorry, I mis-read those as php. You're right, it is unlikely a binary file is getting the line ending treatment (and that would probably cause a lot more problems :)). – Angelo Genovese Jul 29 '14 at 22:10
  • @pmod stackoverflow.com/a/5022417/356838 I feel that could be the case since the files were committed from the ubuntu server, I am unsure how they actually resolved it in this case? – pal4life Jul 29 '14 at 22:10
  • @pal4life what git ls-tree shows for you? They just removed duplicates on linux machine, as far as I see... – pmod Jul 29 '14 at 22:13
  • @pmod Updated the answer, let me know if you suggest any other options for ls-tree – pal4life Jul 29 '14 at 22:17
  • @pal4life So, go to linux machine and remove DIR? (check if there is a diff between dir / DIR you would want to keep) – pmod Jul 29 '14 at 22:19
  • @pmod thats what it was. Thanks. – pal4life Jul 29 '14 at 23:40

1 Answers1

1

This looks like a casing issue. DIR vs dir

There is an ignorecase option available in the [core] section of .git/config

e.g. add ignorecase = true

To change it for just one repo, from that folder run:

git config core.ignorecase true To change it globally:

git config --global core.ignorecase true

Answer from How to make git ignore changes in case?

Community
  • 1
  • 1
Sam Plus Plus
  • 4,381
  • 2
  • 21
  • 43