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

Re: can anybody explain the following to a git noob?

From
Andreas Ericsson <ae@op5.se>
Date
May 22, 2009, 12:22 UTC
Message-ID
<4A169902.4070902@op5.se>
In-Reply-To
<855e4dcf0905220436h1b6fa632q7804c98bf09b324c@mail.gmail.com>
Tim Uckun wrote:
>> Did test_new contain ignored files?
> 
> No.  I put the entire transcript in the first email.

No you did not. You used 'ls' where you should have used 'ls -a' to also show the "hidden" directory entries (.gitignore and .git)

> I did not tell
> git to ignore anything and there were no .git directories in the test
> folder.
> 

But the upstream project could well have told git to ignore stuff, and since .gitignore files are transmitted on clone they would have been sent along to you.

Show 8 quoted lines
>> In this case, when you checkout the
>> branch that does not have test_new, only the tracked files are removed;
>> the ignored (i.e untracked) files remain. Therefore, after the checkout
>> you still have a test_new directory.
>>
> 
> As far as I can tell all the files are tracked after I do a commit.
> 

"git ls-tree -r --name-only HEAD" will show you all the tracked files. You'll almost certainly want to pipe it through less or some such.

Try "git ls-tree -r --name-only | grep gitignore" to see all the .gitignore files.

> I can understand why it put the original test directory back when I
> changed to the master branch but I don't understand why it's missing a
> subdirectory.

Because that subdirectory was never tracked by git. If it had been, it would have been there when you switched branches.

Show 10 quoted lines
>  I don't think the test_new directory should be in the
> master branch at all but I guess I can kind of sort of see why git
> might not remove it. What I can't understand at all is why it's
> missing subdirectories.
> 
> I hate to say this but I tried the exact same thing with mercurial in
> the last half hour and it did exactly what I thought it should do. The
> master had the test directory but not the test_new and the branch had
> the test_new directory but not the test. No subdirectories were
> missing out of either one.

Naturally, since mercurial (rightly) ignores .gitignore files and the .git/ directory. With mercurial though, you're not only tracking the history of the files, but also the history of the object databases of all the git repositories you've cloned and that live in subdirectories of your master-project. Whether or not that's an actual problem for you is something you'll have to decide for yourself. If you want to keep that exceptionally odd configuration, please remember to never run "git repack -a" in the subdirectories originating from github clones, or mercurial will think files have gone missing.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Register now for Nordic Meet on Nagios, June 3-4 in Stockholm
 http://nordicmeetonnagios.op5.org/

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Previous: Tim UckunNext: Daniel Barkalow
Message 10 of 16 in “can anybody explain the following to a git noob?”
  1. Tim UckunMay 22, 2009
  2. Avery PennarunMay 22, 2009
  3. Tim UckunMay 22, 2009
  4. Andreas EricssonMay 22, 2009
  5. Tim UckunMay 22, 2009
  6. Johannes SixtMay 22, 2009
  7. Tim UckunMay 22, 2009
  8. Julian PhillipsMay 22, 2009
  9. Tim UckunMay 23, 2009
  10. Andreas EricssonMay 22, 2009
  11. Daniel BarkalowMay 22, 2009
  12. Tim UckunMay 23, 2009
  13. Heiko VoigtMay 25, 2009
  14. Tim UckunMay 25, 2009
  15. Sitaram ChamartyMay 22, 2009
  16. Dan LoewenherzMay 22, 2009

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.