On Mon, Mar 07, 2011 at 11:10:33AM -0800, tombert wrote:

> So this are all folders:
> 
> root folder
>  - generic modules1
>  - generic modules2
>  - sub-projects
>  -- sub-project1
>  -- sub-project2
> 
> in the root folder I say:
> git init
> git add .
> git commit
> 
> then delete e.g. sub-project1 folder
> rm -r sub-project1
> 
> then commiting
> git commit
> 
> now it commits the deleted sub-project - thats what I want to avoid.

I think you're missing something -- Git does not work this way, see:

foo% git init .
Initialized empty Git repository in /tmp/foo/.git/
foo% touch aaa.txt
foo% mkdir bar
foo% touch bar/bbb.txt
foo% git add .
foo% git commit -m "Initial commit"
[master (root-commit) 6c19e98] Initial commit
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 aaa.txt
 create mode 100644 bar/bbb.txt
foo% rm -r bar
foo% git status
# On branch master
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    bar/bbb.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
foo%

Note that `git status` does not list the manually removed directory
"bar" as staged for the next commit; should I run `git commit` at that
point, Git would tell me there's nothing to commit because, as it
clearly tells in its `git status` output, my deletion changed some
files in the work tree, but the index (what's being committed) is not
updated to reflect these changes.

So let's dig deeper:
1) Don't you confuse `rm -f dir` (an OS command) with `git rm -r dir`
   (a Git command)?  The latter does indeed update the index to reflect
   the deletion just done.
2) Are you using some wrapper around Git instead of plain Git?
   That could explain the behaviour you're seeing if your tool tries to
   be more clever that it should.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to