Reputation: 24005
I'm working with git 1.9.3 on OS X 10.10.2 (Yosemite) accessing a repository that's on a Linux machine. It seems that when I stash my local changes and pop the stash back, files change from Unix to DOS line endings:
[Ken-MacBook:~] % file .emacs .gitconfig .zshrc
.emacs: HTML document text
.gitconfig: ASCII text
.zshrc: ASCII text
[Ken-MacBook:~] % git stash
Saved working directory and index state WIP on MacBook: ccc571e Not all systems have $(expr substr)
HEAD is now at ccc571e Not all systems have $(expr substr)
[Ken-MacBook:~] % git stash pop
On branch MacBook
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: .emacs
modified: .gitconfig
modified: .zshrc
no changes added to commit (use "git add" and/or "git commit -a")
Dropped refs/stash@{0} (4678c8b67af424700f41a6a2ef7a772ece7cec54)
[Ken-MacBook:~] % file .emacs .gitconfig .zshrc
.emacs: HTML document text
.gitconfig: ASCII text, with CRLF line terminators
.zshrc: ASCII text, with CRLF line terminators
On a freshly cloned repository, all these files have Unix line endings.
I don't think I have any config that would cause this, but I post it for perusal (slightly redacted):
[Ken-MacBook:~] % git config --list
user.name=Ken Williams
user.email=Ken.Williams@********.com
color.diff=auto
color.status=auto
core.filemode=false
core.pager=less -S
log.decorate=short
merge.conflictstyle=diff3
push.default=simple
diff.xlsx.binary=true
diff.xlsx.textconv=xlsx2csv
alias.lg=log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
alias.lgnc=log --graph --pretty=format:'%h -%d %s (%cr) <%an>'
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true
core.precomposeunicode=true
remote.origin.url=ssh://git@***********.local:7999/amnc/ken-homedir.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
Any thoughts?
Upvotes: 0
Views: 1791
Reputation: 24005
Figured it out - it's because I'm storing my .gitconfig
in Git. One of the local changes I made to my .gitconfig
was to turn off core.autocrlf
; when I stashed, I got that setting back, so that when I unstashed, it was turned on, and I got those pesky DOS line endings back.
Upvotes: 3