When stashing some changes, Git creates two separate commits, 'WIP on branch' and 'index on branch':
$ git log --graph --all
* commit 98aac13303ca086580c1ec9ccba5fe26c2a8ef3c
|\ Merge: 7d99786 82c5c76
| | Author: Tieme <my@email.com>
| | Date: Wed Nov 19 09:58:35 2014 +0100
| |
| | WIP on development: 7d99786 Last real commit
| |
| * commit 82c5c763357c401135675a39bfabf9b7f6805815
|/ Author: Tieme <my@email.com>
| Date: Wed Nov 19 09:58:35 2014 +0100
|
| index on development: 7d99786 Last real commit
|
|
| * commit 7d9978637a0e1ef92f2432189bdebf2317f0b2f0
| Author: Tieme <my@email.com>
| Date: Tue Nov 18 17:32:33 2014 +0100
|
| Last real commit
|
I looked up the documentation for this but it does not make it clearer:
A stash is represented as a commit whose tree records the state of the working directory, and its first parent is the commit at HEAD when the stash was created. The tree of the second parent records the state of the index when the stash is made, and it is made a child of the HEAD commit. The ancestry graph looks like this:
.----W / / -----H----I
where H is the HEAD commit, I is a commit that records the state of the index, and W is a commit that records the state of the working tree.
Why are there 2 commits created and not just a single one for the files I changed ?