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

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

From
Tim Uckun <timuckun@gmail.com>
Date
May 23, 2009, 08:21 UTC
Message-ID
<855e4dcf0905230121h28ef22f8n4758953e612325cf@mail.gmail.com>
In-Reply-To
<alpine.LNX.2.00.0905221244370.2147@iabervon.org>
>
> Obviously, there's more before the transcript started; otherwise, there
> would be nothing to import in the initial commit, and there certainly
> wouldn't be .git directories that came from nowhere.
Sorry. The command before git init is svn export  blah/blah/blah/

I am taking a rails project and putting it under git. The .git files are there in the pluging because the plugins are hosted on github and they ware installed via git clone.

I know people keep mentioning those directories so I want to repeat myself. I renamed the test directory which had no .git folders anywhere in them. It contains the tests for the rails project and nothing else.

Show 7 quoted lines
> I don't think any
> version control system I know of likes having your initial import be of a
> directory with other working directories for the same system as
> subdirectories. (That is, Mercurial will be fine having git working
> directories in the import, but git won't, and Mercurial wouldn't be happy
> about having Mercurial working directories as subdirectories).
>

I now realize that. I did however did the same thing again but first deleted all the .git directories before doing a git init. The end result didn't change.

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

I now understand that this is the way git works. I wasn't expecting this though. I was exptecting the master branch to look like it was before I switched to another branch and mucked around.

As I said in a previous email mercurial worked as I was expecting. Subversion also works the way I expected. Coming from subversion I never expected git to carry the new directory name into the original branch.

The way I have always thought about branches was that they are isolated from other branches and it surprised me greatly when git "leaked" the new directory from the "my_branch" branch into master.

I still kind of think I did something wrong. This behavior seems extremely odd to me.

> This tends to happen if, while on a different branch, you editted some
> files and left editor backups or compiled (maybe just-in-time) files in
> that directory. Then there are files in the directory that don't belong to
> any branch, since they're not source files.

I didn't edit any files. I didn't compile anything. There should have been on artifacts of any sort. I did a commit before switching branches.

> It's also highly likely that what's missing is stuff you thought you
> imported initially, but did not actually import due to the confusion with
> it already being a git working directory.
>

As I said the test directories did not have any .git directories in them. If they had git mv would not have worked.

Previous: Daniel BarkalowNext: Heiko Voigt
Message 12 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.