DEV Community


git diff> & apply vs stash

nirlanka profile image Nir Lanka ニル ・1 min read

I never use git stash and prefer to use git diff HEAD > ../diffs/whatever.diff and later git apply ../diffs/whatever.diff -3 (-3 for 3-way merge enabled).

I know a lot of people use git stash, but I'm not sure it's because they prefer it over git diff, but rather because they haven't considered it.

It could be just me, but I prefer to have my code snippets and changes to be as "tangible" as possible. Ability to back them up, add to git, reuse and all that is much more reliable and convenient with diff > apply.

What are your thoughts?


Editor guide