How can I retrieve the patches associated with a certain file?
Having cloned a git repo I want to retrieve all commits associated with a certain file, printed out each one in a separate file.开发者_如何学Python
This must have something to do with git log or git format patch.
thanks.
You can use git rev-list
to retrieve sha1 of all commit touching a path:
$ git rev-list --all -- path
This will give you a list sha1 of each commit that touch that path. If you want the commit message and patches, you can use git log
:
$ git log --all -- path
$ git log --all -p -- path
If you want to see the changes made to a file at each commit you can use the 'whatchanged' command
git whatchanged [options] <file>
Check out this tutorial for creating and applying patches
精彩评论