开发者

How can I retrieve the patches associated with a certain file?

开发者 https://www.devze.com 2023-02-08 03:50 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消