我在OS X 10.10.2(Yosemite)上使用git 1.9.3访问Linux机器上的存储库。似乎当我存储我的本地更改并弹回存储时,文件从Unix更改为DOS行结束:
[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
在新近克隆的存储库中,所有这些文件都有Unix行结尾。
我不认为我有任何可能会导致此问题的配置,但我会将其发布以供细读(略有修改):
[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
有什么想法吗?
答案 0 :(得分:3)
想出来 - 这是因为我将我的.gitconfig
存储在Git中。我对.gitconfig
所做的一项本地更改是关闭core.autocrlf
;当我被藏起来的时候,我得到了那个设置,所以当我解开时,它被打开了,我把那些讨厌的DOS行结束了。