0

I'm running git 2.17.0 on Cygwin.

Doing a git config --get-regexp color shows me

....
color.status.added bold yellow
color.status.changed red
color.status.untracked white
color.status.branch bold blue
color.status.deleted yellow
color.status.header bold white
....
color.branch.local yellow
....

But when I do a git status, the "modified" and the "deleted" files are displayed in the same colour (red). Note also that in my terminal configuration, "yellow" is defined as visibly different colour from "red", as I can see when I do a git branch, which shows the local branches in the correct colour.

My best guess is that git considers a file from the repo, which I have deleted, for some reason as a 'modified' file, but then I wonder, what the color.status.deleted setting is supposed to mean.

Anybody having an explanation for this? Can other people reproduce this?

1

There are two different type of deleted file in git status.

Suppose that I have a file, regularly commited, called "deleteme" in my git repo. I can do two things:

  1. I can do rm deleteme. At this point, the file is simply modified, from a git point of view, and so it is shown in red.

    ~/Wip/sample $ rm deleteme
    ~/Wip/sample $ git status
    Sul branch master
    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:    deleteme
    
  2. I can do git rm deleteme (or rm deleteme; git add deleteme). At this point the file is deleted and its deletion is in the index, ready to be committed. From the git pov this file is a "deleted" one and so it is shown in yellow.

    ~/Wip/sample $ git rm deleteme
    ~/Wip/sample $ git status
    Sul branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
        deleted:    deleteme
    

P.S. Obviously, in my explanation, the colours are as for your configuration.

  • Finally I understood that there is a difference between rm and git rm! I always wondered why git has its own rm and mv commands..... – user1934428 Jul 26 '18 at 7:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.