Search code examples
gitgit-commit

What does 'delete mode 100644' mean in a git commit?


I made a commit and I get:

229 files changed, 16 insertions(+), 22970 deletions(-)

delete mode 100644 Foo.file
.
.
.
delete mode 100644 Bar.file

FWIW I recently did some git-worktree stuff and created a new worktree but I don't think that has anything to do with this.


Solution

  • The listing at the end of git commit here:

    229 files changed, 16 insertions(+), 22970 deletions(-)
    
    delete mode 100644 Foo.file
    

    is the result of invoking git diff --stat on the then-current (now-previous) and now-current aka HEAD commit, which Git just built by writing out Git's index as a new tree and adding the appropriate metadata.

    You should see the same output if you run git diff HEAD@{1} HEAD. You can also use git diff HEAD~1 HEAD or similar.

    As for why files Foo.file, Bar.file, etc., are omitted from the current commit when they were present in the previous commit: That is necessary because you told Git to remove those files from Git's index. Your git worktree experimentation should have had nothing to do with it since each added work-tree has its own separate index.