Can GitHub show the history of changes made to one file in patch form?

后端 未结 4 1643
别那么骄傲
别那么骄傲 2020-12-22 18:52

If you do git log --patch -- path/to/file, you will get the history of the file along with a diff of all the changes made to it with each commit, like this:

相关标签:
4条回答
  • 2020-12-22 19:28

    If you're on Linux, Then install TIG as:

    sudo apt-get install tig

    and then,

    tig path/to/file/

    It'll show you all the commits and their respective changes

    Talat Parwez

    0 讨论(0)
  • 2020-12-22 19:42

    Based on the answers above and my own attempts to find this exact feature, it appears the correct answer to this question is no.

    Edit: before you down vote, maybe try and prove me wrong. Sometimes the correct answer isn't what you want to hear.

    0 讨论(0)
  • 2020-12-22 19:49

    The following URL will show all the commits for a single file in a format similar to git log -p:

    http://github.com/<username>/<project>/commits/<branch>/<path/to/file>

    ...where:

    • <username> is the username of the person that owns the repo
    • <project> is the repo name
    • <branch> can be 'master' or any other branch
    • <path/to/file> is hopefully self-explanatory

    Picking at (somewhat) random, here is an example from the vim-fugitive repo.

    0 讨论(0)
  • 2020-12-22 19:54

    An alternative to the direct URL answer (which BTW is perfectly correct) using GitHub's interface is to:

    • Click on 'Source' view
    • Switch to a desired branch
    • Look for the file you want until you get to the actual source view for the file
    • Click 'history' on the top right corner
    0 讨论(0)
提交回复
热议问题