Jonathan Day
Jonathan Day

Reputation: 18692

How do I get a "git log" patch for a specific commit

If I have a commit hash that has not yet been pushed to origin, how can I generate a patch for that commit only. I would like to use git log -p --no-names but can't see a switch to pass in a specific commit hash. Should I be using a different git command?

Upvotes: 28

Views: 19909

Answers (1)

manojlds
manojlds

Reputation: 301037

For git log patch:

git log -p -1 <commit>

You should be using git format-patch for patches though:

git format-patch -1 <commit>

http://www.kernel.org/pub/software/scm/git/docs/git-format-patch.html

Upvotes: 50

Related Questions