Reputation: 1150
I'm working with a team of developers who are all working on different machines. I happen to be working on a Mac and immediately after cloning any of our repos, I see:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: SomeDirectory/AnotherDirectory/MoreDirectory/AFile.txt
modified: SomeDirectory/AnotherDirectory/DifferentDirectory/AFile.cs
...
And a list of about another 60 files after doing a git status
.
I've tried messing with various config related things and after running git conflig -l
I see:
core.excludesfile=/Users/myname/.gitignore_global
difftool.sourcetree.cmd=opendiff "$LOCAL" "$REMOTE"
difftool.sourcetree.path=
mergetool.sourcetree.cmd=/Applications/SourceTree.app/Contents/Resources/opendiff-w.sh "$LOCAL" "$REMOTE" -ancestor "$BASE" -merge "$MERGED"
mergetool.sourcetree.trustexitcode=true
user.name=My Name
[email protected]
filter.lfs.clean=git-lfs clean %f
filter.lfs.smudge=git-lfs smudge %f
filter.lfs.required=true
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=false
remote.origin.url=https://github.com/MyCompany/RepoName.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
I've tried git reset --hard
/ git clean -f -d
, even just manually doing a git checkout -- <file>
on each of them and nothing seems to make these "modified" files go away.
When running git diff
I see the following for each file:
The file will have its original line endings in your working directory.
warning: CRLF will be replaced by LF in SomeDirectory/AnotherDirectory/DifferentDirectory/AFile.cs.
How can I solve this?
Upvotes: 1
Views: 2534
Reputation: 19035
Setting core.autocrlf
to true
causes file endings to be converted from <LF>
to <CRLF>
when you check them out. Since you are on a Mac, which uses <LF>
, you probably don't want that setting. From the behavior you are seeing, it looks like you probably have settings in your .gitattributes
file that handles the <LF>
/<CRLF>
translation, so try setting your core.autocrlf
to false
, check out the project again, and see if that fixes your issue.
Upvotes: 1