Starting from v1.0 ContextKeeper continuously auto-saves a git branch snapshot if a change is detected. When tabs with code are opened, moved or closed a new snapshot is generated. Also any changes in tabs layout triggers auto-save. When there are multiple changes in a short time, auto-save will be fired with a delay, after no more changes are detected (with 15 seconds threshold). Auto-save feature is disabled during debugging session to prevent accidental updates.​

Output window

Before the change ContextKeeper had updated a branch snapshot only at solution closing or before switching to another branch. It was a first step to a more robust solution.

Continuous auto-saving branch snapshots

Introducing continuous auto-saving feature is a step closer in improving default Visual Studio session management experience that had stopped improving for years - session is still saved only once, when solution is closed (or saved). It unfortunately doesn't work well when VS crashes in the middle of a work, .suo file gets corrupted in the process or VS is closed "blank" by mistake.

The outcomes are similar: you cannot use your latest opened documents. I work daily with Visual Studio since 2005 and still, after those years, I vividly remember overwhelming surprise mixed with anger when VS opened blank and forgot whole context, built carefully, usually by days. Latest VS version looks more polished but still it can happen. Before ContextKeeper I usually had backuped .suo file for important contexts and switched between them by overwriting original .suo file. This little hack seems to be pretty popular.

When automatic snapshot switching for branches was first introduced in v0.8 a branch snapshot was saved a moment before Visual Studio was closing or changing branches. The solution was simple but it had some hidden flaws. Some files in a snapshot could get lost after changing branches because VS closed them really fast and generated snapshot didn't include those files. Also if VS crashes or you need to kill the VS process from Task Manager a snapshot won't be up to date. All those issues were fixed by introducing branch auto-save feature.

Git worktree support

The git worktree support, introduced in v1.3, allows even more streamlined context switching. If you sometimes clone entire repository when working on a feature I recommend checking git worktree. Long story short, working tree is like clean, cloned repository but better because:

  • repository "cloning" is done instantly - it's a local operation,
  • worktree uses less disk space - there is a single .git folder shared across multiple working trees,
  • often more convenient than stashing

Git rebase detection

ContextKeeper has small and simple built-in engine detecting git branch changes. It uses .git/HEAD file to actively detects current branch and also switching between branches. This approach allows switching between branches to work with any git client and also with VS 2013 which doesn't have native git support. ContextKeeper can even detect and automatically restore a snapshot when git branch is changed from a command line:

Restoring a branch snapshot via git checkout

The branch detection engine is really simple and didn't support rebase operation properly at the beginning. During rebase multiple "intermediate" snapshots were generated but it was fixed in the v1.1 and v1.2 releases. Thanks to Piotr Solarczyk for reporting the issue.