"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