git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: clarify git rm --cached function in gitignore note
@ 2020-10-05  8:58 Sohom Datta via GitGitGadget
  2023-05-03  0:09 ` Sohom
  2023-05-03 15:31 ` [PATCH v2] " Sohom Datta via GitGitGadget
  0 siblings, 2 replies; 7+ messages in thread
From: Sohom Datta via GitGitGadget @ 2020-10-05  8:58 UTC (permalink / raw)
  To: git; +Cc: Sohom Datta, Sohom

From: Sohom <sohom.datta@learner.manipal.edu>

Added text explaining that the git rm --cached command
isn't analogous to the gitignore file and that the file
will need to be added to gitignore to prevent later
commits from adding the file back.

Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
---
    docs: Clarify git rm --cached function in gitignore note
    
    Added text explaining that the git rm --cached command isn't analogous
    to the gitignore file and that the file will need to be added to 
    gitignore to prevent later commits from adding the file back.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-862%2Fsohomdatta1%2Fgitignore-note-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-862/sohomdatta1/gitignore-note-v1
Pull-Request: https://github.com/git/git/pull/862

 Documentation/gitignore.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index d47b1ae296..22d58df805 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -147,7 +147,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.
 
 EXAMPLES
 --------

base-commit: ab4691b67bc1a2cd8d9068fb03e3fbd6979247d6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] docs: clarify git rm --cached function in gitignore note
  2020-10-05  8:58 [PATCH] docs: clarify git rm --cached function in gitignore note Sohom Datta via GitGitGadget
@ 2023-05-03  0:09 ` Sohom
  2023-05-03  4:32   ` Elijah Newren
  2023-05-03 15:31 ` [PATCH v2] " Sohom Datta via GitGitGadget
  1 sibling, 1 reply; 7+ messages in thread
From: Sohom @ 2023-05-03  0:09 UTC (permalink / raw)
  To: gitgitgadget; +Cc: git, sohom.datta

Hey maintainers,

Friendly ping regarding this patch (I assume it slipped through the cracks).

It would be great if the change could be made to the git documentation, since
it still is a common misconception amongst students that merely adding a file
to .gitignore will lead to the file being automagically ignored by git when that
is in fact not the case.

P.S: sohomdatta1+git@gmail.com and sohom.datta@learner.manipal.edu are both me,
that email was used by me previously when I was affiliated to my university.

Regards,
Sohom Datta.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] docs: clarify git rm --cached function in gitignore note
  2023-05-03  0:09 ` Sohom
@ 2023-05-03  4:32   ` Elijah Newren
  0 siblings, 0 replies; 7+ messages in thread
From: Elijah Newren @ 2023-05-03  4:32 UTC (permalink / raw)
  To: Sohom; +Cc: git, sohom.datta, gitgitgadget

Hi,

On Tue, May 2, 2023 at 5:33 PM Sohom <sohomdatta1@gmail.com> wrote:
>
> Hey maintainers,
>
> Friendly ping regarding this patch (I assume it slipped through the cracks).
>
> It would be great if the change could be made to the git documentation, since
> it still is a common misconception amongst students that merely adding a file
> to .gitignore will lead to the file being automagically ignored by git when that
> is in fact not the case.
>
> P.S: sohomdatta1+git@gmail.com and sohom.datta@learner.manipal.edu are both me,
> that email was used by me previously when I was affiliated to my university.
>
> Regards,
> Sohom Datta.

Yeah, looks like it slipped through the cracks.  The documentation
change looks reasonable to me, though given the time that has passed,
the context region has changed so it no longer cleanly applies.  Could
you rebase it and resubmit?

Also, while rebasing, the "isn't analogous" part of the commit message
feels like it misses the mark in the explanation, and the body of the
commit message would be better worded in the imperative tense.
Perhaps change the main paragraph to something like:

Explain to users that the step to untrack a file will not also keep it
untracked in the future.

When you resubmit, go ahead and cc me.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2] docs: clarify git rm --cached function in gitignore note
  2020-10-05  8:58 [PATCH] docs: clarify git rm --cached function in gitignore note Sohom Datta via GitGitGadget
  2023-05-03  0:09 ` Sohom
@ 2023-05-03 15:31 ` Sohom Datta via GitGitGadget
  2023-05-03 17:06   ` Junio C Hamano
  2023-05-03 21:46   ` [PATCH v3] " Sohom Datta via GitGitGadget
  1 sibling, 2 replies; 7+ messages in thread
From: Sohom Datta via GitGitGadget @ 2023-05-03 15:31 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren, Sohom Datta, Sohom

From: Sohom <sohom.datta@learner.manipal.edu>

Explain to users that the step to untrack a file will not also keep it
untracked in the future.

Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
---
    docs: Clarify git rm --cached function in gitignore note
    
    Added text explaining that the git rm --cached command isn't analogous
    to the gitignore file and that the file will need to be added to
    gitignore to prevent later commits from adding the file back.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-862%2Fsohomdatta1%2Fgitignore-note-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-862/sohomdatta1/gitignore-note-v2
Pull-Request: https://github.com/git/git/pull/862

Range-diff vs v1:

 1:  053e9f99c9e ! 1:  c3257398c8f docs: clarify git rm --cached function in gitignore note
     @@ Metadata
       ## Commit message ##
          docs: clarify git rm --cached function in gitignore note
      
     -    Added text explaining that the git rm --cached command
     -    isn't analogous to the gitignore file and that the file
     -    will need to be added to gitignore to prevent later
     -    commits from adding the file back.
     +    Explain to users that the step to untrack a file will not also keep it
     +    untracked in the future.
      
          Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
      
     @@ Documentation/gitignore.txt: The purpose of gitignore files is to ensure that ce
      +can then be added to the `gitignore` file to stop the file from
      +being reintroduced in later commits.
       
     - EXAMPLES
     - --------
     + Git does not follow symbolic links when accessing a `.gitignore` file in
     + the working tree. This keeps behavior consistent when the file is


 Documentation/gitignore.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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.
 
 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
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] docs: clarify git rm --cached function in gitignore note
  2023-05-03 15:31 ` [PATCH v2] " Sohom Datta via GitGitGadget
@ 2023-05-03 17:06   ` Junio C Hamano
  2023-05-03 21:46   ` [PATCH v3] " Sohom Datta via GitGitGadget
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2023-05-03 17:06 UTC (permalink / raw)
  To: Sohom Datta via GitGitGadget; +Cc: git, Elijah Newren, Sohom Datta, Sohom

"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.

> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3] docs: clarify git rm --cached function in gitignore note
  2023-05-03 15:31 ` [PATCH v2] " Sohom Datta via GitGitGadget
  2023-05-03 17:06   ` Junio C Hamano
@ 2023-05-03 21:46   ` Sohom Datta via GitGitGadget
  2023-05-07  1:36     ` Elijah Newren
  1 sibling, 1 reply; 7+ messages in thread
From: Sohom Datta via GitGitGadget @ 2023-05-03 21:46 UTC (permalink / raw)
  To: git; +Cc: Elijah Newren, Sohom Datta, Sohom Datta

From: Sohom Datta <sohom.datta@learner.manipal.edu>

Explain to users that the step to untrack a file will not also prevent them
from getting added in the future.

Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
---
    docs: Clarify git rm --cached function in gitignore note
    
    I've fixed the Sign-Off v/s commit author issue and incorporated the
    changes suggested :)

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-862%2Fsohomdatta1%2Fgitignore-note-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-862/sohomdatta1/gitignore-note-v3
Pull-Request: https://github.com/git/git/pull/862

Range-diff vs v2:

 1:  c3257398c8f ! 1:  ae09ff2e70c docs: clarify git rm --cached function in gitignore note
     @@
       ## Metadata ##
     -Author: Sohom <sohom.datta@learner.manipal.edu>
     +Author: Sohom Datta <sohom.datta@learner.manipal.edu>
      
       ## Commit message ##
          docs: clarify git rm --cached function in gitignore note
      
     -    Explain to users that the step to untrack a file will not also keep it
     -    untracked in the future.
     +    Explain to users that the step to untrack a file will not also prevent them
     +    from getting added in the future.
      
          Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
      
     @@ Documentation/gitignore.txt: The purpose of gitignore files is to ensure that ce
       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
     ++can then be added to the `.gitignore` file to stop the file from
      +being reintroduced in later commits.
       
       Git does not follow symbolic links when accessing a `.gitignore` file in


 Documentation/gitignore.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index f2738b10db6..4c17f2356c4 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.
 
 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
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] docs: clarify git rm --cached function in gitignore note
  2023-05-03 21:46   ` [PATCH v3] " Sohom Datta via GitGitGadget
@ 2023-05-07  1:36     ` Elijah Newren
  0 siblings, 0 replies; 7+ messages in thread
From: Elijah Newren @ 2023-05-07  1:36 UTC (permalink / raw)
  To: Sohom Datta via GitGitGadget; +Cc: git, Sohom Datta, Sohom Datta

On Wed, May 3, 2023 at 2:46 PM Sohom Datta via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Sohom Datta <sohom.datta@learner.manipal.edu>
>
> Explain to users that the step to untrack a file will not also prevent them
> from getting added in the future.
>
> Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
> ---
>     docs: Clarify git rm --cached function in gitignore note
>
>     I've fixed the Sign-Off v/s commit author issue and incorporated the
>     changes suggested :)
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-862%2Fsohomdatta1%2Fgitignore-note-v3
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-862/sohomdatta1/gitignore-note-v3
> Pull-Request: https://github.com/git/git/pull/862
>
> Range-diff vs v2:
>
>  1:  c3257398c8f ! 1:  ae09ff2e70c docs: clarify git rm --cached function in gitignore note
>      @@
>        ## Metadata ##
>      -Author: Sohom <sohom.datta@learner.manipal.edu>
>      +Author: Sohom Datta <sohom.datta@learner.manipal.edu>
>
>        ## Commit message ##
>           docs: clarify git rm --cached function in gitignore note
>
>      -    Explain to users that the step to untrack a file will not also keep it
>      -    untracked in the future.
>      +    Explain to users that the step to untrack a file will not also prevent them
>      +    from getting added in the future.
>
>           Signed-off-by: Sohom Datta <sohom.datta@learner.manipal.edu>
>
>      @@ Documentation/gitignore.txt: The purpose of gitignore files is to ensure that ce
>        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
>      ++can then be added to the `.gitignore` file to stop the file from
>       +being reintroduced in later commits.
>
>        Git does not follow symbolic links when accessing a `.gitignore` file in
>
>
>  Documentation/gitignore.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
> index f2738b10db6..4c17f2356c4 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.
>
>  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
> --
> gitgitgadget

v3 looks good to me:

Reviewed-by: Elijah Newren <newren@gmail.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-05-07  1:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05  8:58 [PATCH] docs: clarify git rm --cached function in gitignore note Sohom Datta via GitGitGadget
2023-05-03  0:09 ` Sohom
2023-05-03  4:32   ` Elijah Newren
2023-05-03 15:31 ` [PATCH v2] " Sohom Datta via GitGitGadget
2023-05-03 17:06   ` Junio C Hamano
2023-05-03 21:46   ` [PATCH v3] " Sohom Datta via GitGitGadget
2023-05-07  1:36     ` Elijah Newren

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).