Subject: How can I do an automatic stash when doing a checkout?

From: DeMarcus <[email-masked]>
Date: Sun, 18 Dec 2011 12:19:56 +0100

Hi,

I'm new to git and currently I'm working with SVN and there it's a bit 
messier doing branching but once I've branched then all my development 
there is completely separated from any other branch. When I want to work 
on another branch I just change directory.

This is not how it works with git, where when I want to change branch I 
have to do a git checkout. However, that leaves all the modified and 
untracked files in the directory of the branch I switched to. This is 
seldom the behavior I want.

With the git stash command I can clean the directory the way I want but 
the stash command is not connected to a particular branch.

Is there a way to have git checkout do an automatic stash when doing a 
checkout to another branch, and then do an automatic git stash apply 
with the correct stash when changing back to the previous branch again?

Thanks,
Daniel