From: "brian m. carlson" <firstname.lastname@example.org> To: <email@example.com> Cc: "Martin Ågren" <firstname.lastname@example.org> Subject: [PATCH 3/3] docs: explain how to deal with files that are always modified Date: Sat, 12 Sep 2020 20:48:24 +0000 [thread overview] Message-ID: <email@example.com> (raw) In-Reply-To: <firstname.lastname@example.org> Users frequently have problems where two files differ only in case, causing one of those files to show up consistently as being modified. Let's add a FAQ entry that explains how to deal with that. In addition, let's explain another common case where files are consistently modified, which is when files using a smudge or clean filter have not been run through that filter. Explain the way to fix this as well. Signed-off-by: brian m. carlson <email@example.com> --- Documentation/gitfaq.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Documentation/gitfaq.txt b/Documentation/gitfaq.txt index 154f0cce54..494ec5dce5 100644 --- a/Documentation/gitfaq.txt +++ b/Documentation/gitfaq.txt @@ -362,6 +362,39 @@ information about how to configure files as text or binary. You can also control this behavior with the `core.whitespace` setting if you don't wish to remove the carriage returns from your line endings. +[[always-modified-files-case]] +Why do I have a file that's always modified?:: + Internally, Git always stores file names as sequences of bytes and doesn't + perform any encoding or case folding. However, Windows and macOS by default + both perform case folding on file names. As a result, it's possible to end up + with multiple files or directories that differ in case. Git can handle this + just fine, but the file system can store only one of these files, so when Git + reads the other file to see its contents, it looks modified. ++ +It's best to remove one of the files such that you only have one file. You can +do this with commands like the following (assuming two files `AFile.txt` and +`afile.txt`) on an otherwise clean working tree: ++ +---- +$ git rm --cached AFile.txt +$ git commit -m 'Remove files conflicting in case' +$ git checkout . +---- ++ +This avoids touching the disk, but removes the additional file. Your project +may prefer to adopt a naming convention, such as all-lowercase names, to avoid +this problem from occurring again; such a convention can be checked using a +`pre-receive` hook or as part of a continuous integration (CI) system. ++ +It is also possible for perpetually modified files to occur on any platform if a +smudge or clean filter is in use on your system but a file was previously +committed without running the smudge or clean filter. To fix this, run the +following on an otherwise clean working tree: ++ +---- +$ git add --renormalize . +---- + [[recommended-storage-settings]] What's the recommended way to store files in Git?:: While Git can store and handle any file of any type, there are some
next prev parent reply other threads:[~2020-09-12 20:51 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-09-12 20:48 [PATCH 0/3] FAQ entries for merges and modified files brian m. carlson 2020-09-12 20:48 ` [PATCH 1/3] docs: explain why squash merges are broken with long-running branches brian m. carlson 2020-09-13 15:05 ` Martin Ågren 2020-09-13 17:12 ` brian m. carlson 2020-09-12 20:48 ` [PATCH 2/3] docs: explain why reverts are not always applied on merge brian m. carlson 2020-09-13 15:12 ` Martin Ågren 2020-09-12 20:48 ` brian m. carlson [this message] 2020-09-13 15:13 ` [PATCH 3/3] docs: explain how to deal with files that are always modified Martin Ågren 2020-09-12 21:48 ` [PATCH 0/3] FAQ entries for merges and modified files Junio C Hamano 2020-09-20 23:22 ` [PATCH v2 " brian m. carlson 2020-09-20 23:22 ` [PATCH v2 1/3] docs: explain why squash merges are broken with long-running branches brian m. carlson 2020-09-20 23:22 ` [PATCH v2 2/3] docs: explain why reverts are not always applied on merge brian m. carlson 2020-09-20 23:22 ` [PATCH v2 3/3] docs: explain how to deal with files that are always modified brian m. carlson
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 List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH 3/3] docs: explain how to deal with files that are always modified' \ /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
Code repositories for project(s) associated with this inbox: https://80x24.org/mirrors/git.git 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 read-only IMAP folder(s) and NNTP newsgroup(s).