Working with a File's Local History

 Summary

The Local History feature fills the gap between a full version control system and no version control at all. Every time you make changes to a file and save or build it, the Local History feature will keep a copy of one or more previous saved versions for a predetermined length of time (seven days by default). You will then be able to do a diff comparison between the current version and any past version in its buffer.

Overview

The intent of Local History is to keep track of the changes a developer make to a program before having something worthy of committing to the version control system. It is also extremely useful for the independent or small company developer without access to a version control system as it provides similar features. The primary difference is that it only works within the IDE, so it cannot be used to keep track of changes from other team members on other computers. The history is local to the computer on which it was established and will not stay with a project that is moved to another computer. If you need this functionality across multiple systems, a true version control system such as Subversion is a more appropriate mplabx:subversione tool.

Enabling Local History

Local History is enabled by default with a buffer of 7 days. So there is nothing you need to do to take advantage of it immediately.
To disable Local History, set the number of days to keep history to zero.

Adjusting Local History time span

1

From the main menu, select Tools ▸ Options

2

In the window that opens, click on the Team icon Tools_Options_Team.png

3

Select the Versioning tab.

4

Select History from the list on the left side.

5

Change the number of days and click the OK button to accept the change.

LocalHistoryBuffer2.png
Click image to enlarge.

How to view a file's Local History

1

Either right click on an open file's tab in the editor or right click on a file in the project tree. Then select Local History ▸ Show Local History from the pop-up menu.

LocalHistoryAccess-Tab.png
Click image to enlarge.


-OR-

2

Select from the file menu in the Project Tree

LocalHistoryAccess-Tree.png
Click image to enlarge.

3

In the new tab that opens up in the editor, select the old version you want to compare in the top part of the pane. In the lower half of the pane, the old version will be shown on the left and the current version on the right. The built in diff utility clearly shows you where the files differ and makes it easy to cancel new changes or revert to older code.

LocalHistoryView.png
Click image to enlarge.

How to revert a file or parts of a file to an earlier version

There are three distinct actions you may take in the Local History view to revert the current file to an earlier version.

To remove code that didn't exist in the older file but was added to the current file, click the little red "X" in the margin by the line numbers.

LocalHistoryDeleteBlock.png
Click image to enlarge.

To insert code from an older file into the current file, click on the blue arrow in the margin by the line numbers.

LocalHistoryInsertBlock.png
Click image to enlarge.

To revert the entire current file to an older version, click on the blue arrow in the middle-top of the diff window.

LocalHistoryRevert.png
Click image to enlarge.

How to add a label to a local history entry

The local history list contains two columns: Version and Label. The label can be used to annotate each version of the file. Simply click in the blank space in the label column and begin typing.

LocalHistoryLabel.png
Click image to enlarge.

20th Annual
Microchip MASTERs Conference 2016
Register now - Deadline: July 29

JW Marriott Desert Ridge Resort-Phoenix, AZ

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.