I started my journey on Thursday when I tried to automate the task of closing Visual Studio doing the git checkout and then starting Visual studio again. I failed on that account, and I found that my win7 installation was a bit corrupt, but I got some good help and a comment that got me thinking. So I continued on my quest and on Saturday I installed powerconsole and found what I could do with it. By the end of the day and many blogposts later I found a solution that worked. Here is that solution.
$filename = $dte.Solution.FileName
git add .
git commit -a -m "auto commit before checkout"
git checkout $branch
Looks very simple and elegant indeed.
The only problem being that even a successful checkout seems to result in a exception. But it does not bother me to much. I can now do everything from within Visual Studio and I saved a few keystrokes at the same time.