Being careful is usually enough to prevent problems, but sometimes I need to double check the branch I'm working on (e.g. "hmm... I'm in the dev branch, right?") by checking the source control path of a random file.

In looking for an easier way, I thought of naming the solution files accordingly (e.g. MySolution_Dev.sln) but with different file names in each branch, I can't merge the solution files.

It's not that big of a deal but are there any methods or "small tricks" you use to quickly ensure you're in the correct branch? I'm using Visual Studio 2010 with TFS 2008.

  • 2
    This sounds like a good candidate for a VS 2010 Extension to be written which allows some sort of configurable visual cue to indicate the branch. Perhaps colorizing the background of the Solution Explorer as per user settings (I'd do green for Dev, yellow for QA and red for Prod). Commented Oct 14, 2011 at 15:58
  • Nice idea, even an indicator on VS title bar would help.
    – henginy
    Commented Oct 14, 2011 at 16:10
  • 1
    I'd say that should be pretty effective. I have my bash prompt set to include my git branch and whether the source files are clean or if they need a checkin
    – Daenyth
    Commented Oct 14, 2011 at 16:58
  • Does TFS not have something equivalent to git status or hg status?
    – user8
    Commented Oct 14, 2011 at 17:59
  • I use VS user interface for TFS operations, so I don't really have an idea.
    – henginy
    Commented Oct 16, 2011 at 10:44

10 Answers 10


I am using this http://visualstudiogallery.msdn.microsoft.com/f3f23845-5b1e-4811-882f-60b7181fa6d6

Updates your title to for example:






Hope it helps

  • That seems to do it, I'll give it a try..
    – henginy
    Commented Jul 2, 2013 at 13:02
  • I use this extension for exactly this purpose. In fact, I was about to post the link, when I saw that ynnok already had.
    – Bobson
    Commented Jul 2, 2013 at 13:29
  • 1
    I ended up using this one as I can see it in the title on which branch I am. Really awesome!!!
    – Piotr Kula
    Commented Aug 20, 2013 at 9:54
  • Yes, it's indeed very convenient!
    – henginy
    Commented Dec 5, 2013 at 22:04

Name the working directories differently. That is, if your project is titled "MY_PROJECT," create a different working directory for each branch. If there is one branch named "dev," then you'd need a directory for trunk and a directory for dev, like this:

  • Actually working directories are named differently. But with an already open Visual Studio, (for example after I take a coffee break and return to my desk) I have to check the path of a file to see the directory. So I guess it's the simplest way and no escape from that?
    – henginy
    Commented Oct 14, 2011 at 13:18
  • 2
    @henginy That's a good clarification. To determine that in Visual Studio, I hover over the tab of an open file. It will display a tooltip of the full file system path, from which I can determine whether the root is "-dev" or "-trunk." Try that and see if it works for you. Commented Oct 14, 2011 at 13:45
  • 1
    Yes, that is exactly how I "check the source control path of a random file", and I'm trying to find a quicker way:)
    – henginy
    Commented Oct 14, 2011 at 13:59
  • @henginy Oh, right. You said that in OP. I don't know of a better way off the top of my head. Sounds like I haven't improved on your situation at all. :-( Commented Oct 14, 2011 at 16:18
  • I should've clarified that better in my question. Thank you for your help!
    – henginy
    Commented Oct 16, 2011 at 10:40

I don't work in a generic dev or trunk branch.

I ALWAYS do work in feature branches. When a feature is done, I follow these steps.

  1. Open Source Control Explorer.
  2. Merge from dev into current feature branch.
  3. Fix any conflicts and ensure everything still works.
  4. Check in again. Merge feature into dev branch.
  5. Open dev solution.
  6. Checkin dev branch.
  7. Close dev solution.
  8. Let CI build and deploy.

I only have the dev branch open for a few minutes at a time and close it right away.


You could create an empty file in each branch, e.g THIS_IS_TRUNK.txt in trunk, and THIS_IS_DEV.txt in DEV.

  • 2
    That might actually work..Especially with an underscore in front of the file name to move it up in solution explorer.
    – henginy
    Commented Oct 14, 2011 at 14:02

I do a lot of my (D)VCS work from the command line. I highly reccomend having your prompt display where you are at. For instance, my prompt when in a Git repo looks like (I do this for SVN too):

[BranchName]RepoTop/path/to/current/wd >>

And if the repo is currently dirty (uncommitted changes):

[BranchName!!]RepoTop/path/to/current/wd >>

I also have the background set to red if logged into prod, things like that. I find simple visual notifications to be super effective for me.

You mentioned that you often see this most after coming back to your computer. I find a post it note, with my current focus (branch, bug #, feature) stuck to my keyboard when I leave, to be super effective in allowing me to get back to work quickly, rather than recreate whatever it was I did last.


There's a free Visual Studio extension called TFS Solution Info that may help with this. It shows you the current branch and workspace in a little window that you can dock/pin wherever you want.

  • Look awesome but does support VS2012
    – Piotr Kula
    Commented Aug 20, 2013 at 9:54

I've been using VSCommands extension (with Visual Studio 2012, but there is a 2010 version) and it conveniently puts the branch name in the upper left corner of the screen as well as into the solution explorer.

Not affiliated with the product in any way, just a happy user.

  • 1
    It looks cool bad sadly you got to pay for all the extra stuff that might not be needed :(
    – Piotr Kula
    Commented Aug 20, 2013 at 10:04

I avoid working in the wrong branch by doing almost everything in one branch (in trunk - per so called "unstable trunk" branching strategy).

The cases when I am forced to update branches are pretty rare - these are pre-and post-production bugfixes (prod candidate code is isolated in branches). Since these fixes should be in trunk too, I typically draft, test and verify them right there in trunk, then port to prod branch. Porting as a rule involves just a straightforward copy of 1 to 5 files to branch and build check.

  • I am also somewhat lucky that in most of my projects management preferred to convince customers to use newer releases instead of patching old ones - this brings post-production part of updates in branches to almost negligible minimum.
  • It's indeed nice not to have to maintain previous releases. In that case I'd only use a branch for experimental purposes I guess.
    – henginy
    Commented Oct 16, 2011 at 10:35
  • @henginy I can't recall cases when I had a luxury of not having to maintain previous releases at all. However, management attitude can make a big difference here: depending on it one can eg either implement 1-2 hotfixes/year in older branches or mess with these half of all the time
    – gnat
    Commented Oct 16, 2011 at 20:39

A specific answer depends on the version control software that you're using, but there's usually a command that lets you easily see the branch you're working on. For example, with Subversion, use the svn info command in a directory to see the URL for that branch. If you're more interested in a particular file, you can specify that too:

caleb-dev$ svn info foo.c 
Path: foo.c
Name: foo.c
URL: https://svn.mycompany.com/repo/sample/branches/caleb-dev/foo.c
Repository Root: https://svn.mycompany.com/repo/sample
Repository UUID: d62f7aef-3ad2-6098-12a-c16647d854ab
Revision: 1042
Node Kind: file
Schedule: normal
Last Changed Author: caleb
Last Changed Rev: 1031
Last Changed Date: 2011-06-07 15:28:27 -0400 (Tue, 07 Jun 2011)
Text Last Updated: 2011-06-08 03:08:12 -0400 (Wed, 08 Jun 2011)
Checksum: 123456789098765432123456789098

From the URL, I can see that my copy of foo.c is in the caleb-dev branch.

I don't need to do that very often because my local directory has the same name as the branch. A quick look at my command line prompt is usually enough to confirm that I'm in the right directory, and therefore working in the right branch.


Lots of answers here already, but none that touches on the simple solution we have where I work: for each branch, create a new VM containing a dev environment, and check out from the proper branch. You only have to do that and get it right once, and then you just switch VMs to switch branches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.