Using git diff, how can I get added and modified lines numbers?

前端 未结 12 2044
清酒与你
清酒与你 2020-11-30 22:13

Assuming I have a text file

alex
bob
matrix
will be removed
git repo

and I have updated it to be

alex
new line here
another         


        
12条回答
  •  情歌与酒
    2020-11-30 23:02

    git diff --stat will show you the output you get when committing stuff which is the one you are referring to I guess.

    git diff --stat
    

    For showing exactly the line numbers that has been changed you can use

    git blame -p  | grep "Not Committed Yet"
    

    And the line changed will be the last number before the ending parenthesis in the result. Not a clean solution though :(

提交回复
热议问题