File versioning in Mage
Mage can automatically keep track of previous versions of a file.
Overview
Mage has file versioning built-in— that means you don’t need to configure Git to roll-back changes or recover old file versions.
Any update to the contents of a file will create a new version that can be used to restore a file to a previous state. This also includes changes to a pipeline.
Configure the number of versions per file
You can set how many previous versions to keep track of for every file.
Set the following environment variable name and value:
Name | MAX_NUMBER_OF_FILE_VERSIONS |
Value | Any integer value. |
Default | 100 |
Where are the file versions stored?
Each file version is stored in the following directory:
[project_name]/.file_versions
For example, if your project name is demo_project
, then the directory will be demo_project/.file_versions
.
Please add .file_versions
to your .gitignore
file.
For more information, please read the project setup guide.
How to view file versions
For Mage versions <0.9.58
- Open a pipeline.
- Edit the pipeline.
- In the file browser on the left side of the page, click on a file.
- Near the top on the right side, click the button Show versions.
- A list of previous versions for that file will appear in the right side panel.
For Mage versions >=0.9.58
- Go to the project Files page (located at
/files
). - In the file browser on the left side of the page, click on a file.
- In the middle section header above the file editor, click Show file versions.
- A list of previous versions for that file will appear in the right side panel.
How to restore to a previous version
- In the right side panel, click on a previous version.
- Click the button labeled Replace with this version.
- The contents of the file will be updated with the contents from the previous version.
Was this page helpful?