git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] docs: clarify git rm --cached function in gitignore note

From
Junio C Hamano <gitster@pobox.com>
Date
May 3, 2023, 17:06 UTC
Message-ID
<xmqqild9tkdt.fsf@gitster.g>
In-Reply-To
<pull.862.v2.git.git.1683127916363.gitgitgadget@gmail.com>
"Sohom Datta via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Sohom <sohom.datta@learner.manipal.edu>

Please make sure this line matches what you sign-off the patch as, i.e. the above line should read more like

    From: Sohom Datta <sohom.datta@learner.manipal.edu>
> Explain to users that the step to untrack a file will not also keep it
> untracked in the future.
"also keep it untracked" -> "prevent them from getting added"?

After all, it is not "git" that makes the path tracked. It is the user who says "git add" that file that is not supposed to be tracked.

Show 15 quoted lines
> Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
> ---
> ...
> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
> index f2738b10db6..8b78e1b3e08 100644
> --- a/Documentation/gitignore.txt
> +++ b/Documentation/gitignore.txt
> @@ -146,7 +146,9 @@ The purpose of gitignore files is to ensure that certain files
>  not tracked by Git remain untracked.
>  
>  To stop tracking a file that is currently tracked, use
> -'git rm --cached'.
> +'git rm --cached' to remove the file from the index. The filename
> +can then be added to the `gitignore` file to stop the file from
> +being reintroduced in later commits.

Should that be `.gitignore`, I have to wonder. If the file in question is in a directory `deep/hierarchy`, the user may choose to add it in `deep/hierarchy/.gitignore`, and in that sense, you may have chosen to say "tell the ignore/exclude mechanism" in general without specifying the exact file path, in which case I am OK with that strategy, too. But then, `literal` mark-up is not appropriate as it is no longer something the user types literally.

I'd vote for just saying `.gitignore`; it's simpler and users who want to be creative can improvise at their own risk ;-)

Other than that, looking good.
Thanks.
>  Git does not follow symbolic links when accessing a `.gitignore` file in
>  the working tree. This keeps behavior consistent when the file is
>
> base-commit: 69c786637d7a7fe3b2b8f7d989af095f5f49c3a8
Previous: Sohom Datta via GitGitGadgetNext: Sohom Datta via GitGitGadget
Message 5 of 7 in “docs: clarify git rm --cached function in gitignore note”
  1. docs: clarify git rm --cached function in gitignore noteSohom Datta via GitGitGadget, Oct 5, 2020
  2. SohomMay 3, 2023
  3. Elijah NewrenMay 3, 2023
  4. docs: clarify git rm --cached function in gitignore noteSohom Datta via GitGitGadget, May 3, 2023
  5. Junio C HamanoMay 3, 2023
  6. docs: clarify git rm --cached function in gitignore noteSohom Datta via GitGitGadget, May 3, 2023
  7. Elijah NewrenMay 7, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.