git_encoding_repo>git config --global core.safecrlf true git_encoding_repo>git config core.autocrlf false git_encoding_repo>git config --get core.autocrlf false git_encoding_repo>cat .gitattributes # Set the default behavior, in case people don't have core.autocrlf set. * text=auto *.vcxproj eol=crlf *.sh eol=lf # Denote all files that are truly binary and should not be modified. *.exe binary *.dll binary *.pdb binary *.ico binary *.png binary *.jpg binary git_encoding_repo>git status On branch master No commits yet Untracked files: (use "git add ..." to include in what will be committed) .gitattributes file_name.txt nothing added to commit but untracked files present (use "git add" to track) git_encoding_repo>git ls-files --eol file_name.txt git_encoding_repo>git add . git_encoding_repo>git status On branch master No commits yet Changes to be committed: (use "git rm --cached ..." to unstage) new file: .gitattributes new file: file_name.txt git_encoding_repo>git ls-files --eol file_name.txt i/-text w/-text attr/text=auto file_name.txt git_encoding_repo>git commit -m "Commit utf-16le encoded file which has crlf." [master (root-commit) 91fe3bd] Commit utf-16le encoded file which has crlf. 2 files changed, 13 insertions(+) create mode 100644 .gitattributes create mode 100644 file_name.txt ## At this time, i changed file encoding to utf-8. git_encoding_repo>git status On branch master nothing to commit, working tree clean git_encoding_repo>git add -p Only binary files changed. git_encoding_repo>git status On branch master Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) modified: file_name.txt no changes added to commit (use "git add" and/or "git commit -a") git_encoding_repo>git add file_name.txt git_encoding_repo>git status On branch master Changes to be committed: (use "git reset HEAD ..." to unstage) modified: file_name.txt git_encoding_repo>git commit -m "Change encoding of file to utf-8" [master 179c27b] Change encoding of file to utf-8 1 file changed, 0 insertions(+), 0 deletions(-) rewrite file_name.txt (100%) git_encoding_repo>git remote add origin https://github.com/ashishnegi/git_encoding.git git_encoding_repo>git push -u origin master Counting objects: 7, done. Delta compression using up to 12 threads. Compressing objects: 100% (7/7), done. Writing objects: 100% (7/7), 837 bytes | 837.00 KiB/s, done. Total 7 (delta 0), reused 0 (delta 0) To https://github.com/ashishnegi/git_encoding.git * [new branch] master -> master Branch master set up to track remote branch master from origin. git_encoding_repo>git ls-files --eol file_name.txt i/crlf w/crlf attr/text=auto file_name.txt git_encoding_repo>