Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to enforce line endings on commit in SourceTree

Dan Fogg March 13, 2012

On SourceTree 1.3.2 on mac OS X how does one enforce line endings on commit?

I want to enforce line endings on commit which would be the same as running this command from command line version of git:

git config --global core.autocrlf input

3 answers

1 accepted

0 votes
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2012

That config setting persists across all uses of Git, including SourceTree. When SourceTree calls git, your global config is used so it will behave no differently to the command line.

Dan Fogg March 13, 2012

Thanks. I had run that command against my command line git instance and pointed SourceTree to use that git instance instead of its packaged one, which works. Alternatively I could probably have run that command against the packaged git instance that comes with sourcetree (again using the command line) but I don't see a way to do this from SourceTree itself.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2012

There is no difference. This command changes the ~/.gitconfig file, which is global and nothing to do with where git is run from. Changes in this file affect SourceTree too. This may change if we're forced to sandbox SourceTree in future (the user home directory is then not shared with the app), but in its current form the global gitconfig applies to all git installs, regardless of their location.

2 votes
Rob Newman June 18, 2014

Yeah, we do expose quite a few options in Preferences, this just wasn't one of them :)

I notice a couple of years on, that this is still the case

0 votes
Dan Fogg March 13, 2012

Gottcha, thanks. It'd be nice to have the ability to change global config such as that accessible from SourceTree gui.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 13, 2012

Yeah, we do expose quite a few options in Preferences, this just wasn't one of them :)

Paul O'Flynn March 5, 2015

It's a very common requirement, you should really add it, thanks.

gibbo77 July 22, 2016

Still waiting for an update of AutoCRLF from SourceTree....

 

clith April 18, 2017

and now it's 2017 and still nothing..

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events