Git: remove leading plus/minus from lines in diff

后端 未结 4 1805
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-23 13:26

My question is rather simple, though I have had no luck finding an answer.

I\'d like to remove the leading plus/minus symbols from each line in git diff

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-23 13:56

    The simple way I have seen is this.. Much easy to remember (The text format changes. So you need to know the code change)

    git diff --color-words



    Here is a way to make it default
    If you are using linux add the following command to your ~/.bashrc file
    Then you can use gitdiff without space as another command .

    alias gitdiff='git diff --color-words'
    


    Update:
    To set alias directly through git config (Without the help of ~/.bashrc)
    https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases
    Thank you @dylankb for this.

    Example: If you enter the command git config --global alias.ci commit;
    then you can use git ci for rest of your life for committing!!

    Happy Gitting :)

提交回复
热议问题