Color Indicator for Code Changes – Track Changes in Visual Studio 2010

Track Change” one of the best interesting features in visual studio which indicates the code changes with a color indicator at the beginning of the line.  Generally we know about the two color indicator  “Green” and “Yellow” which are used indicting the color change till VS 2008 along with those VS 2010 introduced another new color “Orange” which indicates some additional track change for undoing file after save. In this blog post I am going to explain how those color indicator helps developers to track the code changes.

In Visual Studio 2010, there is three color indicator

TrackChange_Green  Green color indicates the lines  which you have edited before your last save.  Save again the file and green mark will be disappear.

  TrackChange1

TrackChange_Yellow Yellow color indicates the lines which  you have edited since the  last save of that file.  Yellow becomes Green after saving of the file. Once you close the file that indication disappears.

 TrackChange2

TrackChange_Orange This color indication has newly introduced in VS 2010.  This color will come when  user does an undo after a save operation for that current file. Orange color indicates  that current changed line is different from the saved version of the file. 

 TrackChange3

How to Enable / Disable Track Change features ?

To enable or disable  the “Track Change” features, Goto Tools > Options > TextEditor . In General section, you can checked or Unchecked the “Track Change” option .

TrackChange_Enabled

Key Note :  While you are using “Track Change” option, you have to select “Selection Margin” display option other wise, “Track Change” Won’t work.

TrackChange_Enabled_2

 

One Quick Flow of “Track Change”

You have opened one code file in visual studio 2010 which having below lines of code. By default there is not color indicator with line number.

example1

Now, you have started editing the file Yellow indicator shows , you have made changes on those line.

example2

When you are done with your changes, Save the file. Green indicator shows, all of your changes has been saved.

example3

Now, you have undoing the files after save, orange indicator saying that, the lines is different  than the save version. It means, you have changed some thing on original file, saved it and again undo it. example4

When you first undoing it, it will be showing as “Yellow”, which means you are editing with this line, but when you have done with all the undoing for that line which is different the saved version colors becomes “Orange”. Which means, it is different than the saved version.

To get a clear , just compare the below two image . Yes,  all the orange color  marked line are similar with default version image.

 example1example4

                 Default Code image                                                “Orange” Indicator Image

But, the Saved version of the file is

example3

Similarly, This Track changes also works for config files also.

Summary :Track Change” is one very useful features in Visual studio , by which You can see where you have edited / saved on  a file for that current VS IDE state . Green color indicates the lines  which you have edited before your last save.Yellow color indicates the lines which  you have edited since the  last save of that file. Orange color indicates  that current changed line is different from the saved version of the file.

 If you want to know more about editor setting options , please check the below link

How to: Set Text Editor Options

To know more about the more useful Visual Studio Tips and Trick please follow Sara Ford’s Blog

Hope this will help you !

Thanks !
Shout it

16 comments

  1. Pingback: DotNetShoutout
  2. Does there really 3 colors ? Im using this feature long time and never saw “orange”. I always thought that green is “saved changes”, yellow – unsaved changes.

    Can you make clear example (bunch of keystrokes =) ) how to achieve all 3 colors in single file –
    for example: 1st line – green, 2nd one – orange, 3rd – yellow, so the color difference will be obvious?

    Like

    1. Does there really 3 colors ?

      Yes, it’s 3 color, if you are using VS 2010. Orange is new. I have explained the steps in “One Quick Flow of “Track Change” section. There I have use two side by side image too to give a clear understanding.
      Please let me know if you have still doubts !

      Like

      1. Yes, i read article and also found all 3 Track Changes colors in settings. But I never saw orange one, seriously =). I even changed it to silver after youк post to notify if it will appear. its nitpicking but can you produce keystrokes example how to get “orange” =). My undo show only yellow one – color changed, but not undo’ed.

        Like

  3. Ok, Let me explain the steps.
    1. Open your existing file
    Assume you have the below line of code

    int i = 10;

    And there is no color indicator

    2. Now, just add a comment

    int i = 10 ; // T

    Till the time you are adding the comments, indicator chages to “yellow”

    3. Save the file

    You have “Green” Indicator Now.

    4. Undo the changes

    Start undoing, color becames “Yellow”. Now “undo” the added comment.

    Current code line

    int i = 10;

    Check the color “Orange”

    Hope, this will clears your doubts.

    Like

  4. Heh. I tried this – but still got yellow.

    But – I got orange not where you pointed but on second and following undo’s. So Orange appears on all undo’s after first one – first one is yellow – it will show you where you edited file last time. Something like this.. Thank for bothering =)

    Like

  5. Centur…The difference between yellow and orange is very little …maybe you can try changing the colour of the Track reverted changes and see the difference.

    to change the colour go to
    Tools>Options>Environment>Fonts&Colours>Track reverted changes here you can change the colour that suits you and see the change…

    Hope this helps…

    Like

  6. Abhijit,

    i have a doubt here. When i try to edit the file

    Let us say i=10; is my intial state.
    Now i edit to i=10 \\commemt
    When i try to undo i.e ctrl + z i do see the orange colour. but if i delete the “\\comment” i still see yellow.
    Does thsi feature only work when we use Ctrl + Z.

    Regards,
    John

    Like

Leave a comment