git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Shilpa Kulkarni <syk@payasonline.com>
Cc: git@vger.kernel.org,
	Eyvind Bernhardsen <eyvind.bernhardsen@gmail.com>,
	Finn Arne Gangstad <finnag@pvv.org>
Subject: Re: Git Config Question
Date: Mon, 19 Jul 2010 00:59:09 -0500	[thread overview]
Message-ID: <20100719055909.GA16276@burratino> (raw)
In-Reply-To: <AANLkTin8tW_qiRO57F-yjYHzhUkrZbO1g3L_hmesenGL@mail.gmail.com>

(+cc: Eyvind Bernhardsen, Finn Arne Gangstad)

Hi!

Shilpa Kulkarni wrote:

> 2. Person Y checks in code (commit & push). Checks in file a, b.
>
> 3. Person X does a 'git pull origin master'.
>
> Pull succeeds - however
> 'git status' shows file a, b as modified even though person X has done
> nothing with these files.
[...]
> Someone has recommended we all use
> core.safecrlf=false
> core.autocrlf=false
> But this would require running dos2unix cmd while running scripts on
> linux which seems like an overhead.

I have not kept up with the latest best practices.  But I suspect
something like the following would work:

1. In .git/config, ~/.gitconfig, or /etc/gitconfig, on Windows:

	[core]
		autocrlf = true

See core.autocrlf in git-config(1).  I think git for windows does this
automatically.

2. In .git/config, ~/.gitconfig, or /etc/gitconfig, on Unix:

	[core]
		autocrlf = input

3. Convert line-endings in the tracked content.  Something like:

	$ git status; # make sure there are no untracked files present
	$ git rm -fr --cached .; # stop tracking all files
	$ git add .; # fix line-endings on all files
	$ git commit; # record that you have done so

4. Convert line-endings in the work tree.  Something like:

	$ git rm -fr .; # remove all tracked files
	$ git checkout HEAD -- .; # fetch them back again

5. In .gitattributes, something like:

	*	auto
	*.sh	crlf
	*.[ch]	crlf
	*.jpg	-crlf

See gitattributes(5) for details.

Hope that helps,
Jonathan

  reply	other threads:[~2010-07-19  6:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19  5:04 Git Config Question Shilpa Kulkarni
2010-07-19  5:59 ` Jonathan Nieder [this message]
2010-08-02 19:13   ` Eyvind Bernhardsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100719055909.GA16276@burratino \
    --to=jrnieder@gmail.com \
    --cc=eyvind.bernhardsen@gmail.com \
    --cc=finnag@pvv.org \
    --cc=git@vger.kernel.org \
    --cc=syk@payasonline.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).