Sublime Forum

Line endings are changed after merge

#1

Hello everyone,

I’ve started using Sublime merge two days ago, and I found the software very well designed and I liked using it so far.

Nevertheless, I’ve encountered couple of troubles while using it. For information, I’m also using git bash to check what I’m doing on Sublime Merge.

Firstly, I’m working on a project only using Unix file with LF line endings. On Sublime Merge, I’m able to commit changes … but once I merge one branch to another, I can see that line endings are modified to CRLF when checking with a “git status” command on git bash (See picture). What surprise me the most is the fact that sublime merge does not see those changes.

  • Second point is about “Tools > Edit .gitattributes” that opens me a new file in sublime Text that I’m not able to save.

Please find my debug info:
=== App Version Information ===
Build: 1116

=== Git Version Information ===
Using Git: C:\Program Files\Sublime Merge\Git\cmd\git.exe (bundled)
git version 2.19.1.windows.1
PATH: C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\IBM\RationalSDLC\common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\IBM\RationalSDLC\common;C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\bin;C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\bin;C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\RemoteClient\cteapis;C:\Program Files (x86)\IBM\RationalSDLC\ClearCase\etc\utils;C:\Program Files (x86)\IBM\gsk8\lib;C:\Program Files (x86)\IBM\gsk8\bin;C:\Users\e_ffranc\AppData\Local\Microsoft\WindowsApps

=== Browse Page Information ===
HEAD: 9ed4e68ba58af3f3b9b4f681525cfee2a696e392
Is in merge: 0
Is in cherry_pick: 0
Is in rebase: 0
Is in revert: 0

=== Git Status Information ===
M config_files/oms_user.json
?? config_files/edr/NPU-22/NPU-22.xml
?? redis_plantuml
?? “\303\251change databus”

=== Our Status Information ===
M config_files/oms_user.json
?? config_files/edr/NPU-22/NPU-22.xml
?? redis_plantuml
?? échange databus

=== Git Config Information ===
alias.ap=add -p
alias.br=branch
alias.ci=commit
alias.co=checkout
alias.d=diff
alias.dc=diff --cached
alias.dt=difftool
alias.lg=log --oneline --graph --decorate --all
alias.mt=mergetool
alias.rollback=reset --mixed HEAD~1
alias.rvb=diff --no-prefix --full-index --no-color
alias.st=status
branch.autosetuprebase=always
branch.master.merge=refs/heads/master
branch.master.rebase=true
branch.master.remote=origin
color.branch=auto
color.diff=always
color.interactive=true
color.status=auto
color.ui=always
core.autocrlf=true
core.bare=false
core.editor=‘C:/Program Files/Notepad++/notepad++.exe’ -multiInst -notabbar -nosession -noPlugin
core.excludesfile=~/.gitignore
core.filemode=false
core.fscache=true
core.ignorecase=true
core.logallrefupdates=true
core.pager=less -FXRS
core.repositoryformatversion=0
core.symlinks=false
core.worktree=…/…/…/…/…/etrainc/soft/oms
credential.helper=manager
diff.astextplain.textconv=astextplain
diff.tool=bc3
difftool.bc3.cmd=“C:/Progra~2/beyond compare 3/bcomp.exe” $LOCAL $REMOTE
difftool.prompt=false
filter.lfs.clean=git-lfs clean – %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.smudge=git-lfs smudge – %f
help.format=html
http.sslcainfo=/ssl/certs/ca-bundle.crt
merge.tool=bc3
mergetool.bc3.cmd=“C:/Progra~2/beyond compare 3/bcomp.exe” $LOCAL $REMOTE $BASE $MERGED
mergetool.bc3.trustexitcode=true
mergetool.keepbackup=false
mergetool.prompt=false
pack.packsizelimit=2g
push.default=simple
rebase.autosquash=true
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
remote.origin.url=ssh://git@10.25.71.5:2922/Oms/oms.git
user.name=Florian FRANCO

=== Our Config Information ===
Git Config Path Information
Using config path: /C/ProgramData/Git/config
Using config path: /C/Program Files/Sublime Merge/Git/mingw64/etc/gitconfig
Using config path: /C/Users/e_ffranc/.config/git/config
Using config path: /C/Users/e_ffranc/.gitconfig
Using config path: /C/Users/e_ffranc/OneDrive/OMS/.git/modules/etrainc/soft/oms/config

Our config output is different to the Git config output
alias.ap=add -p
alias.br=branch
alias.ci=commit
alias.co=checkout
alias.d=diff
alias.dc=diff --cached
alias.dt=difftool
alias.lg=log --oneline --graph --decorate --all
alias.mt=mergetool
alias.rollback=reset --mixed HEAD~1
alias.rvb=diff --no-prefix --full-index --no-color
alias.st=status
branch.autosetuprebase=always
branch.master.merge=refs/heads/master
branch.master.rebase=true
branch.master.remote=origin
color.branch=auto
color.diff=always
color.interactive=true
color.status=auto
color.ui=always
core.autocrlf=true
core.bare=false
core.excludesfile=~/.gitignore
core.filemode=false
core.fscache=true
core.ignorecase=true
core.logallrefupdates=true
core.pager=less -FXRS
core.repositoryformatversion=0
core.symlinks=false
core.worktree=…/…/…/…/…/etrainc/soft/oms
credential.helper=manager
diff.astextplain.textconv=astextplain
diff.tool=bc3
difftool.bc3.cmd=“C:/Progra~2/beyond compare 3/bcomp.exe” $LOCAL $REMOTE
difftool.prompt=false
filter.lfs.clean=git-lfs clean – %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.smudge=git-lfs smudge – %f
help.format=html
http.sslcainfo=/ssl/certs/ca-bundle.crt
merge.tool=bc3
mergetool.bc3.cmd=“C:/Progra~2/beyond compare 3/bcomp.exe” $LOCAL $REMOTE $BASE $MERGED
mergetool.bc3.trustexitcode=true
mergetool.keepbackup=false
mergetool.prompt=false
pack.packsizelimit=2g
push.default=simple
rebase.autosquash=true
remote.origin.fetch=+refs/heads/:refs/remotes/origin/
remote.origin.url=ssh://git@10.25.71.5:2922/Oms/oms.git
user.name=Florian FRANCO

=== Git Attributes Information ===
git check_attr --all output
config_files/edr/NPU-22/NPU-22.xml

=== Our Modified Files Newline Normalisation and EOL Information ===
config_files/oms_user.json: autocrlf - crlf

0 Likes

#2

Are you currently hiding whitespace? Try toggling whitespace (Ctrl+P then choose the Ignore Whitespace in Diffs: Toggle command)

You can also toggle whitespace by right clicking in a file diff & choosing Show Whitespace Changes or Hide Whitespace Changes.

0 Likes

#3

Thank you for answering.

I’ve already checked that option, and I can’t see changes in file.

My main trouble is that Sublime Merge is modifying the line endings when commiting or merging, I think it’s most probably about configuration of Sublime Merge, but I can’t figure out how to change that

0 Likes

#4

It isn’t about Sublime Merge but the Git itself. In case, the Git bundled in Sublime Merge probably the gitconfig inside the C:\Program Files is set to autocrlf true instead of input.

I have many repositories using LF endings and now I’m using Windows and figure out the same question using Sublime Merge.

Edit the C:\Program Files\Sublime Merge\Git\mingw64\etc\gitconfig and change autocrlf to input.

You can override (if you aren’t admin) creating a new .gitconfig in C:\Users\yourname\.gitconfig and change it. Documentation: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

0 Likes

#5

You should never edit the bundled configuration files within C:\Program Files\Sublime Merge as they are overwritten by updates.

0 Likes