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

.git ignored regardless of --git-dir value

From
SFShawn Ferris <shawn.ferris@gmail.com>
Date
Nov 18, 2011, 20:56 UTC
Message-ID
<CAC2kKA_PZNDg_dPjWXKeFU4ZVpMas3PubZfSgTnfCfVPuNPdsA@mail.gmail.com>
Hi All --

Is it expected behavior to have the .git directory ignored, even after specifying an alternate location with --git-dir? For example:

$ git --git-dir=.foo init Initialized empty Git repository in /home/sferris/work/t/.foo/

$ mkdir .git $ touch .git/filea

$ git --git-dir=.foo --work-tree=. add .

$ git --git-dir=.foo --work-tree=. status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: .foo/HEAD # new file: .foo/config # new file: .foo/description # new file: .foo/hooks/applypatch-msg.sample # new file: .foo/hooks/commit-msg.sample # new file: .foo/hooks/post-update.sample # new file: .foo/hooks/pre-applypatch.sample # new file: .foo/hooks/pre-commit.sample # new file: .foo/hooks/pre-rebase.sample # new file: .foo/hooks/prepare-commit-msg.sample # new file: .foo/hooks/update.sample # new file: .foo/index.lock # new file: .foo/info/exclude # # Changes not staged for commit: # (use "git add/rm <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # deleted: .foo/index.lock # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .foo/index # .foo/objects/

Notice that .foo was added, but .git was ignored. I would have expected .foo to be ignored and .git to be added? (right, wrong or indifferent..)

Thanks for any info!
Shawn
Next: Junio C Hamano
Message 1 of 4 in “.git ignored regardless of --git-dir value”
  1. Shawn FerrisNov 18, 2011
  2. Junio C HamanoNov 18, 2011
  3. Junio C HamanoNov 18, 2011
  4. Shawn FerrisNov 18, 2011

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.