How can I create a GIT Stash from Commit?

I would like to create a new GIT stash from commit on a branch. Is it possible?

+4
source share
1 answer

But why? If you have a commit, then you already have these changes applied to your files. Some files may have changed since the commit, but then if you try to get a quote for these commit changes, then stash will be the difference between your current files and the state of these files when commit. I'm trying to say that I can’t come up with a case when you need it.

But in any case, you can get the commit changes, create a diff, apply it, and then save everything that was different.

git diff YOUR-COMMIT^ YOUR-COMMIT > stash.diff
git apply stash.diff
git commit .
git stash

stash.diff. git diff git apply.

+2

All Articles