Daniel Băluţă
Daniel Băluţă

Reputation: 1275

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.

This must have something to do with git log or git format patch.

thanks.

Upvotes: 1

Views: 724

Answers (2)

RDL
RDL

Reputation: 7961

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

Upvotes: 0

Sylvain Defresne
Sylvain Defresne

Reputation: 44463

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

Upvotes: 3

Related Questions