git: Show index diff in commit message as comment

前端 未结 5 611
清歌不尽
清歌不尽 2021-01-30 05:10

When git commit open the message editor is shows a brief status, something like this:

# Please enter the commit message for your changes. Lines star         


        
5条回答
  •  不思量自难忘°
    2021-01-30 05:22

    The simplest way to make sure this behavior is always present is to add this section to your git config file:

    [commit]
      verbose = true
    

    You may need to configure your editor to actually display in diff mode (for syntax highlighting). I use Notepad2 as a Windows Notepad replacement, and -s diff sets the color scheme appropriately (red for deleted lines, etc.):

    [core]
      editor = C:/Windows/system32/notepad.exe -s diff
    

提交回复
热议问题