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

"git add sub1/ sub2/" doesn't work as expected when sub1 and sub2 has .git under them

From
Ping Yin <pkufranky@gmail.com>
Date
Jan 12, 2009, 08:36 UTC
Message-ID
<46dff0320901120036h97d4162ucd37c17b9dfb6217@mail.gmail.com>

Assume directories sub1 and sub2 have .git under them. "git add sub1/" works as expected (files under sub1/ are added), howerver "git add sub1/ sub2/" doesn't work as expeced (sub1 and sub2 are added as submoudle).

$ git --version git version 1.6.0.4.617.g2baf1

# create repo super $ mkdir super && cd super && git init && git commit --allow-empty -m "Initial commit"

# create repo super/sub1 with file sub1-file $ mkdir sub1 && cd sub1 && touch sub1-file $ git init && git add . && git commit -m "Initial commit" && cd ..

# create repo super/sub2 with file sub2-file $ mkdir sub2 && cd sub2 && touch sub2-file $ git init && git add . && git commit -m "Initial commit" && cd ..

# to intend to add files under sub1 and sub2, but submodules are added $ git add sub1/ sub2/ $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: sub1 # new file: sub2 #

$ git rm --cached sub1 sub2

# to intend add files under sub1, ok $ gtad sub1/ $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: sub1/sub1-file # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # sub2/

Ping Yin
Message 1 of 1 in “"git add sub1/ sub2/" doesn't work as expected when sub1 and sub2 has .git under them”
  1. Ping YinJan 12, 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.