View the change history of a file using Git versioning

后端 未结 24 2050
臣服心动
臣服心动 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:13

    git whatchanged -p filename is also equivalent to git log -p filename in this case.

    You can also see when a specific line of code inside a file was changed with git blame filename. This will print out a short commit id, the author, timestamp, and complete line of code for every line in the file. This is very useful after you've found a bug and you want to know when it was introduced (or who's fault it was).

提交回复
热议问题