View the change history of a file using Git versioning

后端 未结 24 2043
臣服心动
臣服心动 2020-11-22 16:40

How can I view the change history of an individual file in Git, complete details with what has changed?

I have got as far as:

git log -- [filename]
         


        
24条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 17:29

    Add this alias to your .gitconfig:

    [alias]
        lg = log --all --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'\n--abbrev-commit --date=relative
    

    And use the command like this:

    > git lg
    > git lg -- filename
    

    The output will look almost exactly the same as the gitk output. Enjoy.

提交回复
热议问题