0

I often have these kind of results when using git diff:

     /*
  +   * Newly added comment
  +   */
  +
  +
  +  /*
      * Old comment
      */

This is technically correct (since the first line did not change) but makes the later commit information hard to understand - especially when this happens with newly inserted functions:

  void function(bool param1,
  +    bool param2,
  +    bool param3)
  +{
  +    //Something else happens here
  +}
  +
  +void function(bool param1,
       bool param2)
   {
       //Something happens here
   }

Is there any possibility to give git diff a hint that a whole new block has been inserted, in order to receive:

  +void function(bool param1,
  +    bool param2,
  +    bool param3)
  +{
  +    //Something else happens here
  +}
  +
  void function(bool param1,
       bool param2)
   {
       //Something happens here
   }
PhilLab
  • 4,777
  • 1
  • 25
  • 77
  • git diff only is interested in calculating the minimal diff since that is stored in the backend. It aims to reduce disk space usage. – Willem Van Onsem Mar 24 '15 at 11:18
  • Oh, I did not know that. Ok, so the priorities lie elsewere. But in the mentioned case, the primary objective still holds (since both lines are equal and it is just a matter of design which one of them to include in the diff) - so it would be theoretically possible to have a more user-friendly experience without breaking the original purpose. And it would definitively be needed, since diffs are often read by humans – PhilLab Mar 24 '15 at 11:27
  • @PhilLab The context caries that purpose. – svlasov Mar 24 '15 at 11:31

0 Answers0