I rely on a custom patch process quite a bit in my workflow along with Git stashes. Sometimes I find myself trying different ways to solve a problem. Occasaionally, one stash will end up with something I tried and liked while another stash doesn't have it.
When you're in the situation, it's useful to be able to quickly tell what's the difference between 2 stashes that are similar. This allows me to pick out the solution from an older stash and put it in the new code.
It's a bit meta, but you can use Git to tell the difference between stashes.
First, start off with getting the names of your stashes with git stash list
. It will result in something like this:
stash@{0}: On master: wip-file-1-interesting
stash@{1}: On master: wip-file-1-exciting
Next, run a diff on the stashes you're trying to compare with git diff stash@{0} stash@{1}
. You'll get the difference between the files like this:
diff --git a/file1.txt b/file1.txt
index 863c3f0..0c30f39 100644
--- a/file1.txt
+++ b/file1.txt
@@ -1,3 +1,3 @@
This is file 1.
-It's very interesting.
\ No newline at end of file
+It's very exciting.
\ No newline at end of file
With 2 simple commands, you now have the difference between 2 stashes and can pick out that useful code from each stash.