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

Re: Feature Request - Hide ignored files before checkout

From
Chris Rorvick <chris@rorvick.com>
Date
Dec 8, 2012, 19:21 UTC
Message-ID
<CAEUsAPaHJ+N0EnxGuVkRqcmY0fUy+4myMiWtd1_vu1vRL763JQ@mail.gmail.com>
In-Reply-To
<000301cdd4dd$f8554090$e8ffc1b0$@gmail.com>

On Fri, Dec 7, 2012 at 6:50 PM, Matthew Ciancio <matthew.ciancio16@gmail.com> wrote:

Show 11 quoted lines
> Imagine this scenario:
>
> 1) You have a Git repo with two branches (branchA and branchB), which are
> currently identical.
> 2) Checkout to branch.
> 3) Create file foo.txt, stage it and commit it.
> 4) Create file ignore.txt and add it to the ".gitignore" file of branchB so
> that it is successfully ignored by Git.
> 5) Checkout to branchA.
>
> Problem: ignore.txt does not "disappear" like foo.txt does

When you say "disappear", do you mean "deleted from the file system" or something else?

> and is now just
> sitting in branchA (and now any other branch I checkout into).

It's not in branchA, it's just no longer ignored because your changes to .gitignore were effectively reverted by jumping back to the commit that branchA points to.

> When I first started using Git, I genuinely thought this was a bug, because
> it seems so logical to me that ignore files should hide/reappear just like
> tracked files do, when switching branches.

"hide/reappear" is the equivalent to saying "deleted/created" in the case of a tracked file in your working tree. But how would Git cause an untracked file to reappear? By definition, it doesn't know anything about the file.

> P.S. Here is a forum post I made on StackOverflow about the issue:
> http://stackoverflow.com/questions/13761682/gitignore-hide-ignored-files-dur
> ing-checkout

I posted an answer there, too, but I'm not sure I fully understand the problem. The top-voted answer doesn't make much sense, though.

Thanks,
Chris
Previous: Matthew CiancioNext: Junio C Hamano
Message 2 of 9 in “Feature Request - Hide ignored files before checkout”
  1. Matthew CiancioDec 8, 2012
  2. Chris RorvickDec 8, 2012
  3. Junio C HamanoDec 9, 2012
  4. Matthew CiancioDec 9, 2012
  5. Andrew ArdillDec 10, 2012
  6. Matthew CiancioDec 10, 2012
  7. Erik Faye-LundDec 10, 2012
  8. Chris RorvickDec 9, 2012
  9. Matthew CiancioDec 9, 2012

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.