On Fri, 2 Oct 2015 11:37:48 -0700
Michael <keybou...@gmail.com> wrote:

> Is there a way in git to apply the _DIFF_ of a commit as a patch?


  $ git diff stash@{0}^1 stash@{0} | git apply

The basic idea behind this is that a stash entry is a commit containing
the state of the files in the work tree, which has two parent commits:

1) The HEAD at the time of stashing;
2) The state of the index at the time of stashing.

So, diffing the first parent of the stash to the stash itself should
provide what you want.
To apply the diff to the work tree, use `git apply`.

To produce the diff for an individual file, use

  $ git diff stash@{0}^1 stash@{0} path/to/that/file

In other words, there's no magic once you know what the stash entry
really is.

You might consider running `gitk --all` (GUI) or

  $ git log --all --oneline --abbrev=commit --decorate

(console) to study how a stash entry looks.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to